\n \n Namespace can not be added in this destination.\n Obor názvů nejde přidat do tohoto cílového umístění.\n \n \n \n Only attributes, expressions or statements can be made explicit\n Jako explicitní jde nastavit jenom atributy, výrazy nebo příkazy.\n \n \n \n R&emove and Sort Imports\n &Odebrat a seřadit importy\n \n \n \n &Sort Imports\n &Seřadit importy\n \n \n \n <event>\n <událost>\n \n \n \n <handler>\n <obslužná_rutina>\n \n \n \n The expression to be evaluated and converted.\n Výraz k vyhodnocení a převedení\n \n \n \n The name of the data type to which the value of expression will be converted.\n Název datového typu, na který se převede hodnota výrazu\n \n \n \n <expression>\n <výraz>\n \n \n \n <typeName>\n <typeName>\n \n \n \n Associates an event with an event handler, delegate or lambda expression at run time.\n Za běhu přidruží událost k obslužné rutině události, delegátu nebo lambda výrazu.\n \n \n \n The event to associate an event handler, delegate or lambda expression with.\n Událost, ke které se má přidružit obslužná rutina události, delegát nebo lambda výraz\n \n \n \n The event handler to associate with the event. This may take the form of { AddressOf <eventHandler> | <delegate> | <lambdaExpression> }.\n Obslužná rutina události, která se má přidružit k události. Může být ve tvaru { AddressOf <eventHandler> | <delegate> | <lambdaExpression> }.\n \n \n \n If <expression> evaluates to a reference or Nullable value that is not Nothing, the function returns that value. Otherwise, it calculates and returns <expressionIfNothing>.\n Pokud se <výraz> vyhodnotí jako odkaz nebo hodnota s možnou hodnotou null, která není Nothing, funkce vrátí tuto hodnotu. Jinak vypočítá a vrátí <výraz_pokud_Nothing>.\n \n \n \n Returned if it evaluates to a reference or nullable type that is not Nothing.\n Vrátí se, pokud se vyhodnotí na odkaz nebo typ s možnou hodnotou null, který není Nothing.\n \n \n \n Evaluated and returned if <expression> evaluates to Nothing.\n Vyhodnotí se a vrátí se, pokud se <výraz> vyhodnotí jako Nothing.\n \n \n \n <expressionIfNothing>\n <expressionIfNothing>\n \n \n \n Returns the result of explicitly converting an expression to a specified data type.\n Vrací výsledek explicitně převedeného výrazu na zadaný datový typ, objekt, strukturu, třídu nebo rozhraní.\n \n \n \n Introduces a type conversion operation similar to CType. The difference is that CType succeeds as long as there is a valid conversion, whereas DirectCast requires that one type inherit from or implement the other type.\n Zavádí operaci převodu typu podobnou k CType. Rozdíl je v tom, že CType uspěje, pokud existuje platný převod, zatímco DirectCast vyžaduje, aby jeden typ dědil z dalšího typu nebo implementoval další typ.\n \n \n \n The type name to return a System.Type object for.\n Název typu, pro který se má vrátit objekt System.Type\n \n \n \n Returns a System.Type object for the specified type name.\n Vrátí objekt System.Type pro zadaný název typu.\n \n \n \n The XML namespace prefix to return a System.Xml.Linq.XNamespace object for. If this is omitted, the object for the default XML namespace is returned.\n Předpona názvového prostoru XML, pro kterou se má vracet objekt System.Xml.Linq.XNamespace. Pokud není určená, vrátí se objekt pro výchozí názvový prostor XML.\n \n \n \n <xmlNamespacePrefix>\n <předpona_názvového_prostoru_XML>\n \n \n \n Returns the System.Xml.Linq.XNamespace object corresponding to the specified XML namespace prefix.\n Vrátí objekt System.Xml.XLinq.XNamespace odpovídající zadané předponě názvového prostoru XML.\n \n \n \n Replaces a specified number of characters in a String variable with characters from another string.\n Nahradí určitý počet znaků v proměnné typu Řetězec znaky z jiného řetězce.\n \n \n \n The name of the string variable to modify.\n Název proměnné řetězce k úpravě\n \n \n \n The one-based character position in the string where the replacement of text begins.\n Pozice znaku se základem 1 v řetězci, kde začne nahrazování textu\n \n \n \n The number of characters to replace. If omitted, the length of <stringExpression> is used.\n Počet znaků k nahrazení. Pokud není určený, použije se délka <výraz_řetězce>.\n \n \n \n <stringName>\n <stringName>\n \n \n \n <startIndex>\n <startIndex>\n \n \n \n <length>\n <délka>\n \n \n \n <stringExpression>\n <výraz_řetězce>\n \n \n \n Converts an expression to the {0} data type.\n Převede výraz na datový typ {0}.\n \n \n \n Removes the association between an event and an event handler or delegate at run time.\n Za běhu odebere přidružení mezi událostí a obslužnou rutinou události nebo delegátem.\n \n \n \n The event to disassociate an event handler or delegate from.\n Událost, u které se má zrušit přidružení obslužné rutiny události nebo delegáta\n \n \n \n The event handler to disassociate from the event. This may take the form of { AddressOf <eventHandler> | <delegate> }.\n Obslužná rutina události, jejíž přidružení k události se má zrušit. Může být ve tvaru { AddressOf <eventHandler> | <delegate> }.\n \n \n \n If <condition> returns True, the function calculates and returns <expressionIfTrue>. Otherwise, it returns <expressionIfFalse>.\n Pokud <condition> vrátí True, funkce vypočítá a vrátí <expressionIfTrue>. Jinak vrátí <expressionIfFalse>.\n \n \n \n The expression to evaluate.\n Výraz k vyhodnocení\n \n \n \n Evaluated and returned if <condition> evaluates to True.\n Vyhodnotí se a vrátí se, pokud se <podmínka> vyhodnotí jako True.\n \n \n \n Evaluated and returned if <condition> evaluates to False.\n Vyhodnotí se a vrátí se, pokud se <podmínka> vyhodnotí jako False.\n \n \n \n <condition>\n <podmínka>\n \n \n \n <expressionIfTrue>\n <expressionIfTrue>\n \n \n \n <expressionIfFalse>\n <expressionIfFalse>\n \n \n \n Introduces a type conversion operation that does not throw an exception. If an attempted conversion fails, TryCast returns Nothing, which your program can test for.\n Zavádí operaci převodu typu, která nevyvolá výjimku. Pokud se pokus o převod nezdaří, TryCast vrací hodnotu Nothing, kterou může váš program testovat.\n \n \n \n Node does not descend from root.\n Uzel nesestupuje z kořene.\n \n \n \n Node not in parent's child list\n Uzel není v seznamu podřízených položek u nadřazené položky.\n \n \n \n Trivia is not associated with token\n Triviální prvek není přidružený k tokenu.\n \n \n \n <typeOrMember>\n <typeOrMember>\n \n \n \n The type of member to return the name of.\n Typ člena, jehož název se má vrátit\n \n \n \n Produces a string for the name of the specified type or member.\n Vytvoří řetězec názvu určeného typu nebo člena.\n \n \n \n <result>\n <výsledek>\n \n \n
\n \n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":405,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Analyzers/CSharp/Tests/MakeLocalFunctionStatic/MakeLocalFunctionStaticTests.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CodeFixes;\nusing Microsoft.CodeAnalysis.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic;\nusing Microsoft.CodeAnalysis.Diagnostics;\nusing Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;\nusing Microsoft.CodeAnalysis.Test.Utilities;\nusing Roslyn.Test.Utilities;\nusing Xunit;\nusing Xunit.Abstractions;\n\nnamespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeLocalFunctionStatic\n{\n public partial class MakeLocalFunctionStaticTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest\n {\n public MakeLocalFunctionStaticTests(ITestOutputHelper logger)\n : base(logger)\n {\n }\n\n internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)\n => (new MakeLocalFunctionStaticDiagnosticAnalyzer(), GetMakeLocalFunctionStaticCodeFixProvider());\n\n private static readonly ParseOptions CSharp72ParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7_2);\n private static readonly ParseOptions CSharp8ParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp8);\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestAboveCSharp8()\n {\n await TestInRegularAndScriptAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n int [||]fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n static int fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSimpleUsingStatement)]\n public async Task TestWithOptionOff()\n {\n await TestMissingInRegularAndScriptAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n int [||]fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nnew TestParameters(\n parseOptions: CSharp8ParseOptions,\n options: Option(CSharpCodeStyleOptions.PreferStaticLocalFunction, CodeStyleOptions2.FalseWithSilentEnforcement)));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMissingIfAlreadyStatic()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n static int [||]fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMissingPriorToCSharp8()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n int [||]fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp72ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMissingIfCapturesValue()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M(int i)\n {\n int [||]fibonacci(int n)\n {\n return i <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMissingIfCapturesThis()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n int [||]fibonacci(int n)\n {\n M();\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestAsyncFunction()\n {\n await TestInRegularAndScriptAsync(\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n async Task [||]fibonacci(int n)\n {\n return n <= 1 ? n : await fibonacci(n - 1) + await fibonacci(n - 2);\n }\n }\n}\",\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n static async Task fibonacci(int n)\n {\n return n <= 1 ? n : await fibonacci(n - 1) + await fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterSemicolon(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n int x;{leadingTrivia}\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n int x;\n\n static int fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterOpenBrace(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{{leadingTrivia}\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n static int fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterLocalFunction(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n bool otherFunction()\n {{\n return true;\n }}{leadingTrivia}\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n bool otherFunction()\n {\n return true;\n }\n\n static int fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterExpressionBodyLocalFunction(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n bool otherFunction() => true;{leadingTrivia}\n int [||]fibonacci(int n) => n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n}}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n bool otherFunction() => true;\n\n static int fibonacci(int n) => n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterComment(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n //Local function comment{leadingTrivia}\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n //Local function comment{leadingTrivia}\n static int fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaBeforeComment(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{{leadingTrivia}\n //Local function comment\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n$@\"using System;\n\nclass C\n{{\n void M()\n {{{leadingTrivia}\n //Local function comment\n static int fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [WorkItem(46858, \"https://github.com/dotnet/roslyn/issues/46858\")]\n public async Task TestMissingIfAnotherLocalFunctionCalled()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n void [||]A()\n {\n B();\n }\n\n void B()\n {\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallingStaticLocalFunction()\n {\n await TestInRegularAndScriptAsync(\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n void [||]A()\n {\n B();\n }\n\n static void B()\n {\n }\n }\n}\",\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n static void A()\n {\n B();\n }\n\n static void B()\n {\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallingNestedLocalFunction()\n {\n await TestInRegularAndScriptAsync(\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n void [||]A()\n {\n B();\n\n void B()\n {\n }\n }\n }\n}\",\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n static void A()\n {\n B();\n\n void B()\n {\n }\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CodeFixes;\nusing Microsoft.CodeAnalysis.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic;\nusing Microsoft.CodeAnalysis.Diagnostics;\nusing Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;\nusing Microsoft.CodeAnalysis.Test.Utilities;\nusing Roslyn.Test.Utilities;\nusing Xunit;\nusing Xunit.Abstractions;\n\nnamespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeLocalFunctionStatic\n{\n public partial class MakeLocalFunctionStaticTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest\n {\n public MakeLocalFunctionStaticTests(ITestOutputHelper logger)\n : base(logger)\n {\n }\n\n internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)\n => (new MakeLocalFunctionStaticDiagnosticAnalyzer(), GetMakeLocalFunctionStaticCodeFixProvider());\n\n private static readonly ParseOptions CSharp72ParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7_2);\n private static readonly ParseOptions CSharp8ParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp8);\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestAboveCSharp8()\n {\n await TestInRegularAndScriptAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n int [||]fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n static int fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSimpleUsingStatement)]\n public async Task TestWithOptionOff()\n {\n await TestMissingInRegularAndScriptAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n int [||]fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nnew TestParameters(\n parseOptions: CSharp8ParseOptions,\n options: Option(CSharpCodeStyleOptions.PreferStaticLocalFunction, CodeStyleOptions2.FalseWithSilentEnforcement)));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMissingIfAlreadyStatic()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n static int [||]fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMissingPriorToCSharp8()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n int [||]fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp72ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMissingIfCapturesValue()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M(int i)\n {\n int [||]fibonacci(int n)\n {\n return i <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMissingIfCapturesThis()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n int [||]fibonacci(int n)\n {\n M();\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestAsyncFunction()\n {\n await TestInRegularAndScriptAsync(\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n async Task [||]fibonacci(int n)\n {\n return n <= 1 ? n : await fibonacci(n - 1) + await fibonacci(n - 2);\n }\n }\n}\",\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n static async Task fibonacci(int n)\n {\n return n <= 1 ? n : await fibonacci(n - 1) + await fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterSemicolon(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n int x;{leadingTrivia}\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n int x;\n\n static int fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterOpenBrace(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{{leadingTrivia}\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n static int fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterLocalFunction(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n bool otherFunction()\n {{\n return true;\n }}{leadingTrivia}\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n bool otherFunction()\n {\n return true;\n }\n\n static int fibonacci(int n)\n {\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterExpressionBodyLocalFunction(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n bool otherFunction() => true;{leadingTrivia}\n int [||]fibonacci(int n) => n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n}}\",\n@\"using System;\n\nclass C\n{\n void M()\n {\n bool otherFunction() => true;\n\n static int fibonacci(int n) => n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\")]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaAfterComment(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n //Local function comment{leadingTrivia}\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n$@\"using System;\n\nclass C\n{{\n void M()\n {{\n //Local function comment{leadingTrivia}\n static int fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Theory, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [InlineData(\"\\r\\n\")]\n [InlineData(\"\\r\\n\\r\\n\")]\n public async Task TestLeadingTriviaBeforeComment(string leadingTrivia)\n {\n await TestInRegularAndScriptAsync(\n$@\"using System;\n\nclass C\n{{\n void M()\n {{{leadingTrivia}\n //Local function comment\n int [||]fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\n$@\"using System;\n\nclass C\n{{\n void M()\n {{{leadingTrivia}\n //Local function comment\n static int fibonacci(int n)\n {{\n return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n }}\n }}\n}}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [WorkItem(46858, \"https://github.com/dotnet/roslyn/issues/46858\")]\n public async Task TestMissingIfAnotherLocalFunctionCalled()\n {\n await TestMissingAsync(\n@\"using System;\n\nclass C\n{\n void M()\n {\n void [||]A()\n {\n B();\n }\n\n void B()\n {\n }\n }\n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallingStaticLocalFunction()\n {\n await TestInRegularAndScriptAsync(\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n void [||]A()\n {\n B();\n }\n\n static void B()\n {\n }\n }\n}\",\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n static void A()\n {\n B();\n }\n\n static void B()\n {\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallingNestedLocalFunction()\n {\n await TestInRegularAndScriptAsync(\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n void [||]A()\n {\n B();\n\n void B()\n {\n }\n }\n }\n}\",\n@\"using System;\nusing System.Threading.Tasks;\n\nclass C\n{\n void M()\n {\n static void A()\n {\n B();\n\n void B()\n {\n }\n }\n }\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [WorkItem(53179, \"https://github.com/dotnet/roslyn/issues/53179\")]\n public async Task TestLocalFunctionAsTopLevelStatement()\n {\n await TestAsync(@\"\nvoid [||]A()\n{\n}\", @\"\nstatic void A()\n{\n}\",\nparseOptions: CSharp8ParseOptions);\n }\n }\n}\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":406,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/EditorFeatures/CSharpTest/MakeLocalFunctionStatic/MakeLocalFunctionStaticRefactoringTests.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CodeRefactorings;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic;\nusing Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings;\nusing Microsoft.CodeAnalysis.Test.Utilities;\nusing Roslyn.Test.Utilities;\nusing Xunit;\n\nnamespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeLocalFunctionStatic\n{\n public class MakeLocalFunctionStaticRefactoringTests : AbstractCSharpCodeActionTest\n {\n protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace, TestParameters parameters)\n => new MakeLocalFunctionStaticCodeRefactoringProvider();\n\n private static readonly ParseOptions CSharp72ParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7_2);\n private static readonly ParseOptions CSharp8ParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp8);\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerForCSharp7()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp72ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerIfNoCaptures()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal(x);\n\n int [||]AddLocal(int x)\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerIfAlreadyStatic()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal(x);\n\n static int [||]AddLocal(int x)\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerIfAlreadyStaticWithError()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n static int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerIfCapturesThisParameter()\n {\n await TestMissingAsync(\n@\"class C\n{\n int x;\n\n int N()\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldTriggerIfExplicitlyPassedInThisParameter()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int x;\n\n int N()\n {\n int y;\n return AddLocal(this);\n\n int [||]AddLocal(C c)\n {\n return c.x + y;\n }\n } \n}\",\n@\"class C\n{\n int x;\n\n int N()\n {\n int y;\n return AddLocal(this, y);\n\n static int [||]AddLocal(C c, int y)\n {\n return c.x + y;\n }\n } \n}\", parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldTriggerForCSharp8()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\",\n@\"class C\n{\n int N(int x)\n {\n return AddLocal(x);\n\n static int AddLocal(int x)\n {\n return x + 1;\n }\n } \n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMultipleVariables()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal();\n\n int[||] AddLocal()\n {\n return x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal(x, y);\n\n static int AddLocal(int x, int y)\n {\n return x + y;\n }\n }\n}\", parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMultipleCalls()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal() + AddLocal();\n\n int[||] AddLocal()\n {\n return x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal(x, y) + AddLocal(x, y);\n\n static int AddLocal(int x, int y)\n {\n return x + y;\n }\n }\n}\"\n, parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMultipleCallsWithExistingParameters()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, 2);\n return AddLocal(m, m);\n\n int[||] AddLocal(int a, int b)\n {\n return a + b + x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, 2, x, y);\n return AddLocal(m, m, x, y);\n\n static int AddLocal(int a, int b, int x, int y)\n {\n return a + b + x + y;\n }\n }\n}\"\n, parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestRecursiveCall()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, 2);\n return AddLocal(m, m);\n\n int[||] AddLocal(int a, int b)\n {\n return AddLocal(a, b) + x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, 2, x, y);\n return AddLocal(m, m, x, y);\n\n static int AddLocal(int a, int b, int x, int y)\n {\n return AddLocal(a, b, x, y) + x + y;\n }\n }\n}\", parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallInArgumentList()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal(AddLocal(1, 2), AddLocal(3, 4));\n\n int[||] AddLocal(int a, int b)\n {\n return AddLocal(a, b) + x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal(AddLocal(1, 2, x, y), AddLocal(3, 4, x, y), x, y);\n\n static int AddLocal(int a, int b, int x, int y)\n {\n return AddLocal(a, b, x, y) + x + y;\n }\n }\n}\", parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallsWithNamedArguments()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, b: 2);\n return AddLocal(b: m, a: m);\n\n int[||] AddLocal(int a, int b)\n {\n return a + b + x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, b: 2, x: x, y: y);\n return AddLocal(b: m, a: m, x: x, y: y);\n\n static int AddLocal(int a, int b, int x, int y)\n {\n return a + b + x + y;\n }\n }\n}\"\n, parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallsWithDafaultValue()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n string y = \"\";\n var m = AddLocal(1);\n return AddLocal(b: m);\n\n int[||] AddLocal(int a = 0, int b = 0)\n {\n return a + b + x + y.Length;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n string y = \"\";\n var m = AddLocal(1, x: x, y: y);\n return AddLocal(b: m, x: x, y: y);\n\n static int AddLocal(int a = 0, int b = 0, int x = 0, string y = null)\n {\n return a + b + x + y.Length;\n }\n }\n}\"\n, parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestWarningAnnotation()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n void N(int x)\n {\n Func del = AddLocal;\n\n int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\",\n@\"class C\n{\n void N(int x)\n {\n Func del = AddLocal;\n\n {|Warning:static int AddLocal(int x)\n {\n return x + 1;\n }|}\n } \n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestNonCamelCaseCapture()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int Static = 0;\n return AddLocal();\n\n int [||]AddLocal()\n {\n return Static + 1;\n }\n } \n}\",\n@\"class C\n{\n int N(int x)\n {\n int Static = 0;\n return AddLocal(Static);\n\n static int AddLocal(int @static)\n {\n return @static + 1;\n }\n } \n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [WorkItem(46858, \"https://github.com/dotnet/roslyn/issues/46858\")]\n public async Task ShouldNotTriggerIfCallsOtherLocalFunction()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n B();\n return x + 1;\n }\n \n void B()\n {\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallingStaticLocationFunction()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n B();\n return x + 1;\n }\n \n static void B()\n {\n }\n } \n}\",\n@\"class C\n{\n int N(int x)\n {\n return AddLocal(x);\n\n static int [||]AddLocal(int x)\n {\n B();\n return x + 1;\n }\n \n static void B()\n {\n }\n } \n}\",\nparseOptions: CSharp8ParseOptions);\n }\n }\n}\n\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CodeRefactorings;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic;\nusing Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings;\nusing Microsoft.CodeAnalysis.Test.Utilities;\nusing Roslyn.Test.Utilities;\nusing Xunit;\n\nnamespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeLocalFunctionStatic\n{\n public class MakeLocalFunctionStaticRefactoringTests : AbstractCSharpCodeActionTest\n {\n protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace, TestParameters parameters)\n => new MakeLocalFunctionStaticCodeRefactoringProvider();\n\n private static readonly ParseOptions CSharp72ParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7_2);\n private static readonly ParseOptions CSharp8ParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp8);\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerForCSharp7()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp72ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerIfNoCaptures()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal(x);\n\n int [||]AddLocal(int x)\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerIfAlreadyStatic()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal(x);\n\n static int [||]AddLocal(int x)\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerIfAlreadyStaticWithError()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n static int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldNotTriggerIfCapturesThisParameter()\n {\n await TestMissingAsync(\n@\"class C\n{\n int x;\n\n int N()\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldTriggerIfExplicitlyPassedInThisParameter()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int x;\n\n int N()\n {\n int y;\n return AddLocal(this);\n\n int [||]AddLocal(C c)\n {\n return c.x + y;\n }\n } \n}\",\n@\"class C\n{\n int x;\n\n int N()\n {\n int y;\n return AddLocal(this, y);\n\n static int [||]AddLocal(C c, int y)\n {\n return c.x + y;\n }\n } \n}\", parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task ShouldTriggerForCSharp8()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\",\n@\"class C\n{\n int N(int x)\n {\n return AddLocal(x);\n\n static int AddLocal(int x)\n {\n return x + 1;\n }\n } \n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMultipleVariables()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal();\n\n int[||] AddLocal()\n {\n return x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal(x, y);\n\n static int AddLocal(int x, int y)\n {\n return x + y;\n }\n }\n}\", parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMultipleCalls()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal() + AddLocal();\n\n int[||] AddLocal()\n {\n return x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal(x, y) + AddLocal(x, y);\n\n static int AddLocal(int x, int y)\n {\n return x + y;\n }\n }\n}\"\n, parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestMultipleCallsWithExistingParameters()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, 2);\n return AddLocal(m, m);\n\n int[||] AddLocal(int a, int b)\n {\n return a + b + x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, 2, x, y);\n return AddLocal(m, m, x, y);\n\n static int AddLocal(int a, int b, int x, int y)\n {\n return a + b + x + y;\n }\n }\n}\"\n, parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestRecursiveCall()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, 2);\n return AddLocal(m, m);\n\n int[||] AddLocal(int a, int b)\n {\n return AddLocal(a, b) + x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, 2, x, y);\n return AddLocal(m, m, x, y);\n\n static int AddLocal(int a, int b, int x, int y)\n {\n return AddLocal(a, b, x, y) + x + y;\n }\n }\n}\", parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallInArgumentList()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal(AddLocal(1, 2), AddLocal(3, 4));\n\n int[||] AddLocal(int a, int b)\n {\n return AddLocal(a, b) + x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n return AddLocal(AddLocal(1, 2, x, y), AddLocal(3, 4, x, y), x, y);\n\n static int AddLocal(int a, int b, int x, int y)\n {\n return AddLocal(a, b, x, y) + x + y;\n }\n }\n}\", parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallsWithNamedArguments()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, b: 2);\n return AddLocal(b: m, a: m);\n\n int[||] AddLocal(int a, int b)\n {\n return a + b + x + y;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n int y = 10;\n var m = AddLocal(1, b: 2, x: x, y: y);\n return AddLocal(b: m, a: m, x: x, y: y);\n\n static int AddLocal(int a, int b, int x, int y)\n {\n return a + b + x + y;\n }\n }\n}\"\n, parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallsWithDafaultValue()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n string y = \"\";\n var m = AddLocal(1);\n return AddLocal(b: m);\n\n int[||] AddLocal(int a = 0, int b = 0)\n {\n return a + b + x + y.Length;\n }\n }\n}\",\n@\"class C\n{\n int N(int x)\n {\n string y = \"\";\n var m = AddLocal(1, x: x, y: y);\n return AddLocal(b: m, x: x, y: y);\n\n static int AddLocal(int a = 0, int b = 0, int x = 0, string y = null)\n {\n return a + b + x + y.Length;\n }\n }\n}\"\n, parseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestWarningAnnotation()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n void N(int x)\n {\n Func del = AddLocal;\n\n int [||]AddLocal()\n {\n return x + 1;\n }\n } \n}\",\n@\"class C\n{\n void N(int x)\n {\n Func del = AddLocal;\n\n {|Warning:static int AddLocal(int x)\n {\n return x + 1;\n }|}\n } \n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestNonCamelCaseCapture()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n int Static = 0;\n return AddLocal();\n\n int [||]AddLocal()\n {\n return Static + 1;\n }\n } \n}\",\n@\"class C\n{\n int N(int x)\n {\n int Static = 0;\n return AddLocal(Static);\n\n static int AddLocal(int @static)\n {\n return @static + 1;\n }\n } \n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [WorkItem(46858, \"https://github.com/dotnet/roslyn/issues/46858\")]\n public async Task ShouldNotTriggerIfCallsOtherLocalFunction()\n {\n await TestMissingAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n B();\n return x + 1;\n }\n \n void B()\n {\n }\n } \n}\", parameters: new TestParameters(parseOptions: CSharp8ParseOptions));\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n public async Task TestCallingStaticLocationFunction()\n {\n await TestInRegularAndScriptAsync(\n@\"class C\n{\n int N(int x)\n {\n return AddLocal();\n\n int [||]AddLocal()\n {\n B();\n return x + 1;\n }\n \n static void B()\n {\n }\n } \n}\",\n@\"class C\n{\n int N(int x)\n {\n return AddLocal(x);\n\n static int [||]AddLocal(int x)\n {\n B();\n return x + 1;\n }\n \n static void B()\n {\n }\n } \n}\",\nparseOptions: CSharp8ParseOptions);\n }\n\n [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]\n [WorkItem(53179, \"https://github.com/dotnet/roslyn/issues/53179\")]\n public async Task TestLocalFunctionAsTopLevelStatement()\n {\n await TestAsync(@\"\nint y = 10;\nreturn AddLocal();\n\nint[||] AddLocal()\n{\n return y;\n}\n\", @\"\nint y = 10;\nreturn AddLocal(y);\n\nstatic int AddLocal(int y)\n{\n return y;\n}\n\", parseOptions: CSharp8ParseOptions);\n }\n }\n}\n\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":407,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Features/CSharp/Portable/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixProvider.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Immutable;\nusing System.Composition;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CodeActions;\nusing Microsoft.CodeAnalysis.CodeFixes;\nusing Microsoft.CodeAnalysis.Diagnostics;\nusing Microsoft.CodeAnalysis.Editing;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\n\nnamespace Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic\n{\n [ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.MakeLocalFunctionStatic), Shared]\n internal class MakeLocalFunctionStaticCodeFixProvider : SyntaxEditorBasedCodeFixProvider\n {\n [ImportingConstructor]\n [SuppressMessage(\"RoslynDiagnosticsReliability\", \"RS0033:Importing constructor should be [Obsolete]\", Justification = \"Used in test code: https://github.com/dotnet/roslyn/issues/42814\")]\n public MakeLocalFunctionStaticCodeFixProvider()\n {\n }\n\n public override ImmutableArray FixableDiagnosticIds { get; } =\n ImmutableArray.Create(IDEDiagnosticIds.MakeLocalFunctionStaticDiagnosticId);\n\n internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality;\n\n public override Task RegisterCodeFixesAsync(CodeFixContext context)\n {\n context.RegisterCodeFix(new MyCodeAction(\n c => FixAsync(context.Document, context.Diagnostics[0], c)),\n context.Diagnostics);\n\n return Task.CompletedTask;\n }\n\n protected override Task FixAllAsync(\n Document document, ImmutableArray diagnostics,\n SyntaxEditor editor, CancellationToken cancellationToken)\n {\n var localFunctions = diagnostics.SelectAsArray(d => d.AdditionalLocations[0].FindNode(cancellationToken));\n foreach (var localFunction in localFunctions)\n {\n editor.ReplaceNode(\n localFunction,\n (current, generator) => MakeLocalFunctionStaticCodeFixHelper.AddStaticModifier(current, generator));\n }\n\n return Task.CompletedTask;\n }\n\n private class MyCodeAction : CustomCodeActions.DocumentChangeAction\n {\n public MyCodeAction(Func> createChangedDocument)\n : base(CSharpAnalyzersResources.Make_local_function_static, createChangedDocument, CSharpAnalyzersResources.Make_local_function_static)\n {\n }\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Immutable;\nusing System.Composition;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CodeActions;\nusing Microsoft.CodeAnalysis.CodeFixes;\nusing Microsoft.CodeAnalysis.Diagnostics;\nusing Microsoft.CodeAnalysis.Editing;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\n\nnamespace Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic\n{\n [ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.MakeLocalFunctionStatic), Shared]\n internal class MakeLocalFunctionStaticCodeFixProvider : SyntaxEditorBasedCodeFixProvider\n {\n [ImportingConstructor]\n [SuppressMessage(\"RoslynDiagnosticsReliability\", \"RS0033:Importing constructor should be [Obsolete]\", Justification = \"Used in test code: https://github.com/dotnet/roslyn/issues/42814\")]\n public MakeLocalFunctionStaticCodeFixProvider()\n {\n }\n\n public override ImmutableArray FixableDiagnosticIds { get; } =\n ImmutableArray.Create(IDEDiagnosticIds.MakeLocalFunctionStaticDiagnosticId);\n\n internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality;\n\n public override Task RegisterCodeFixesAsync(CodeFixContext context)\n {\n context.RegisterCodeFix(new MyCodeAction(\n c => FixAsync(context.Document, context.Diagnostics[0], c)),\n context.Diagnostics);\n\n return Task.CompletedTask;\n }\n\n protected override Task FixAllAsync(\n Document document, ImmutableArray diagnostics,\n SyntaxEditor editor, CancellationToken cancellationToken)\n {\n var localFunctions = diagnostics.SelectAsArray(d => d.AdditionalLocations[0].FindNode(getInnermostNodeForTie: true, cancellationToken));\n foreach (var localFunction in localFunctions)\n {\n editor.ReplaceNode(\n localFunction,\n (current, generator) => MakeLocalFunctionStaticCodeFixHelper.AddStaticModifier(current, generator));\n }\n\n return Task.CompletedTask;\n }\n\n private class MyCodeAction : CustomCodeActions.DocumentChangeAction\n {\n public MyCodeAction(Func> createChangedDocument)\n : base(CSharpAnalyzersResources.Make_local_function_static, createChangedDocument, CSharpAnalyzersResources.Make_local_function_static)\n {\n }\n }\n }\n}\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":408,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Portable/Binder/WithTypeParametersBinder.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp\n{\n internal abstract class WithTypeParametersBinder : Binder\n {\n internal WithTypeParametersBinder(Binder next)\n : base(next)\n {\n }\n\n // TODO: Change this to a data structure that won't allocate enumerators\n protected abstract MultiDictionary TypeParameterMap { get; }\n\n // This is only overridden by WithMethodTypeParametersBinder.\n protected virtual LookupOptions LookupMask\n {\n get\n {\n return LookupOptions.NamespaceAliasesOnly | LookupOptions.MustBeInvocableIfMember;\n }\n }\n\n protected bool CanConsiderTypeParameters(LookupOptions options)\n {\n return (options & (LookupMask | LookupOptions.MustBeInstance | LookupOptions.LabelsOnly)) == 0;\n }\n\n internal override void LookupSymbolsInSingleBinder(\n LookupResult result, string name, int arity, ConsList basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref CompoundUseSiteInfo useSiteInfo)\n {\n Debug.Assert(result.IsClear);\n\n if ((options & LookupMask) != 0)\n {\n return;\n }\n\n foreach (var typeParameter in TypeParameterMap[name])\n {\n result.MergeEqual(originalBinder.CheckViability(typeParameter, arity, options, null, diagnose, ref useSiteInfo));\n }\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp\n{\n internal abstract class WithTypeParametersBinder : Binder\n {\n internal WithTypeParametersBinder(Binder next)\n : base(next)\n {\n }\n\n // TODO: Change this to a data structure that won't allocate enumerators\n protected abstract MultiDictionary TypeParameterMap { get; }\n\n // This is only overridden by WithMethodTypeParametersBinder.\n protected virtual LookupOptions LookupMask\n {\n get\n {\n return LookupOptions.NamespaceAliasesOnly | LookupOptions.MustBeInvocableIfMember;\n }\n }\n\n protected bool CanConsiderTypeParameters(LookupOptions options)\n {\n return (options & (LookupMask | LookupOptions.MustBeInstance | LookupOptions.LabelsOnly)) == 0;\n }\n\n internal override void LookupSymbolsInSingleBinder(\n LookupResult result, string name, int arity, ConsList basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref CompoundUseSiteInfo useSiteInfo)\n {\n Debug.Assert(result.IsClear);\n\n if ((options & LookupMask) != 0)\n {\n return;\n }\n\n foreach (var typeParameter in TypeParameterMap[name])\n {\n result.MergeEqual(originalBinder.CheckViability(typeParameter, arity, options, null, diagnose, ref useSiteInfo));\n }\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":409,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/ExpressionEvaluator/Core/Source/ExpressionCompiler/DkmUtilities.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Collections.ObjectModel;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Reflection.Metadata;\nusing Microsoft.CodeAnalysis.Debugging;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Symbols;\nusing Microsoft.VisualStudio.Debugger;\nusing Microsoft.VisualStudio.Debugger.Clr;\nusing Microsoft.VisualStudio.Debugger.Clr.NativeCompilation;\nusing Microsoft.VisualStudio.Debugger.Evaluation;\nusing Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.ExpressionEvaluator\n{\n internal static class DkmUtilities\n {\n internal unsafe delegate IntPtr GetMetadataBytesPtrFunction(AssemblyIdentity assemblyIdentity, out uint uSize);\n\n // Return the set of managed module instances from the AppDomain.\n private static IEnumerable GetModulesInAppDomain(this DkmClrRuntimeInstance runtime, DkmClrAppDomain appDomain)\n {\n if (appDomain.IsUnloaded)\n {\n return SpecializedCollections.EmptyEnumerable();\n }\n\n var appDomainId = appDomain.Id;\n // GetModuleInstances() may include instances of DkmClrNcContainerModuleInstance\n // which are containers of managed module instances (see GetEmbeddedModules())\n // but not managed modules themselves. Since GetModuleInstances() will include the\n // embedded modules, we can simply ignore DkmClrNcContainerModuleInstances.\n return runtime.GetModuleInstances().\n OfType().\n Where(module =>\n {\n var moduleAppDomain = module.AppDomain;\n return !moduleAppDomain.IsUnloaded && (moduleAppDomain.Id == appDomainId);\n });\n }\n\n internal static ImmutableArray GetMetadataBlocks(\n this DkmClrRuntimeInstance runtime,\n DkmClrAppDomain appDomain,\n ImmutableArray previousMetadataBlocks)\n {\n // Add a dummy data item to the appdomain to add it to the disposal queue when the debugged process is shutting down.\n // This should prevent from attempts to use the Metadata pointer for dead debugged processes.\n if (appDomain.GetDataItem() == null)\n {\n appDomain.SetDataItem(DkmDataCreationDisposition.CreateNew, new AppDomainLifetimeDataItem());\n }\n\n var builder = ArrayBuilder.GetInstance();\n IntPtr ptr;\n uint size;\n int index = 0;\n foreach (DkmClrModuleInstance module in runtime.GetModulesInAppDomain(appDomain))\n {\n MetadataBlock block;\n try\n {\n ptr = module.GetMetaDataBytesPtr(out size);\n Debug.Assert(size > 0);\n block = GetMetadataBlock(previousMetadataBlocks, index, ptr, size);\n }\n catch (NotImplementedException e) when (module is DkmClrNcModuleInstance)\n {\n // DkmClrNcModuleInstance.GetMetaDataBytesPtr not implemented in Dev14.\n throw new NotImplementedMetadataException(e);\n }\n catch (Exception e) when (DkmExceptionUtilities.IsBadOrMissingMetadataException(e))\n {\n continue;\n }\n Debug.Assert(block.ModuleVersionId == module.Mvid);\n builder.Add(block);\n index++;\n }\n // Include \"intrinsic method\" assembly.\n ptr = runtime.GetIntrinsicAssemblyMetaDataBytesPtr(out size);\n builder.Add(GetMetadataBlock(previousMetadataBlocks, index, ptr, size));\n return builder.ToImmutableAndFree();\n }\n\n internal static ImmutableArray GetMetadataBlocks(GetMetadataBytesPtrFunction getMetaDataBytesPtrFunction, ImmutableArray missingAssemblyIdentities)\n {\n ArrayBuilder? builder = null;\n foreach (var missingAssemblyIdentity in missingAssemblyIdentities)\n {\n MetadataBlock block;\n try\n {\n uint size;\n IntPtr ptr;\n ptr = getMetaDataBytesPtrFunction(missingAssemblyIdentity, out size);\n Debug.Assert(size > 0);\n block = GetMetadataBlock(ptr, size);\n }\n catch (Exception e) when (DkmExceptionUtilities.IsBadOrMissingMetadataException(e))\n {\n continue;\n }\n if (builder == null)\n {\n builder = ArrayBuilder.GetInstance();\n }\n builder.Add(block);\n }\n return builder == null ? ImmutableArray.Empty : builder.ToImmutableAndFree();\n }\n\n internal static ImmutableArray MakeAssemblyReaders(this DkmClrInstructionAddress instructionAddress)\n {\n var builder = ArrayBuilder.GetInstance();\n foreach (DkmClrModuleInstance module in instructionAddress.RuntimeInstance.GetModulesInAppDomain(instructionAddress.ModuleInstance.AppDomain))\n {\n var symReader = module.GetSymReader();\n if (symReader == null)\n {\n continue;\n }\n MetadataReader reader;\n unsafe\n {\n try\n {\n uint size;\n IntPtr ptr;\n ptr = module.GetMetaDataBytesPtr(out size);\n Debug.Assert(size > 0);\n reader = new MetadataReader((byte*)ptr, (int)size);\n }\n catch (Exception e) when (DkmExceptionUtilities.IsBadOrMissingMetadataException(e))\n {\n continue;\n }\n }\n builder.Add(new AssemblyReaders(reader, symReader));\n }\n return builder.ToImmutableAndFree();\n }\n\n private static unsafe MetadataBlock GetMetadataBlock(IntPtr ptr, uint size)\n {\n var reader = new MetadataReader((byte*)ptr, (int)size);\n var moduleDef = reader.GetModuleDefinition();\n var moduleVersionId = reader.GetGuid(moduleDef.Mvid);\n var generationId = reader.GetGuid(moduleDef.GenerationId);\n return new MetadataBlock(moduleVersionId, generationId, ptr, (int)size);\n }\n\n private static MetadataBlock GetMetadataBlock(ImmutableArray previousMetadataBlocks, int index, IntPtr ptr, uint size)\n {\n if (!previousMetadataBlocks.IsDefault && index < previousMetadataBlocks.Length)\n {\n var previousBlock = previousMetadataBlocks[index];\n if (previousBlock.Pointer == ptr && previousBlock.Size == size)\n {\n return previousBlock;\n }\n }\n\n return GetMetadataBlock(ptr, size);\n }\n\n internal static object? GetSymReader(this DkmClrModuleInstance clrModule)\n {\n var module = clrModule.Module; // Null if there are no symbols.\n if (module == null)\n {\n return null;\n }\n // Use DkmClrModuleInstance.GetSymUnmanagedReader()\n // rather than DkmModule.GetSymbolInterface() since the\n // latter does not handle .NET Native modules.\n return clrModule.GetSymUnmanagedReader();\n }\n\n internal static DkmCompiledClrInspectionQuery? ToQueryResult(\n this CompileResult? compResult,\n DkmCompilerId languageId,\n ResultProperties resultProperties,\n DkmClrRuntimeInstance runtimeInstance)\n {\n if (compResult == null)\n {\n return null;\n }\n\n Debug.Assert(compResult.Assembly != null);\n Debug.Assert(compResult.TypeName != null);\n Debug.Assert(compResult.MethodName != null);\n\n ReadOnlyCollection? customTypeInfo;\n Guid customTypeInfoId = compResult.GetCustomTypeInfo(out customTypeInfo);\n\n return DkmCompiledClrInspectionQuery.Create(\n runtimeInstance,\n Binary: new ReadOnlyCollection(compResult.Assembly),\n DataContainer: null,\n LanguageId: languageId,\n TypeName: compResult.TypeName,\n MethodName: compResult.MethodName,\n FormatSpecifiers: compResult.FormatSpecifiers,\n CompilationFlags: resultProperties.Flags,\n ResultCategory: resultProperties.Category,\n Access: resultProperties.AccessType,\n StorageType: resultProperties.StorageType,\n TypeModifierFlags: resultProperties.ModifierFlags,\n CustomTypeInfo: customTypeInfo.ToCustomTypeInfo(customTypeInfoId));\n }\n\n internal static DkmClrCustomTypeInfo? ToCustomTypeInfo(this ReadOnlyCollection? payload, Guid payloadTypeId)\n {\n return (payload == null) ? null : DkmClrCustomTypeInfo.Create(payloadTypeId, payload);\n }\n\n internal static ResultProperties GetResultProperties(this TSymbol? symbol, DkmClrCompilationResultFlags flags, bool isConstant)\n where TSymbol : class, ISymbolInternal\n {\n var category = (symbol != null) ? GetResultCategory(symbol.Kind)\n : DkmEvaluationResultCategory.Data;\n\n var accessType = (symbol != null) ? GetResultAccessType(symbol.DeclaredAccessibility)\n : DkmEvaluationResultAccessType.None;\n\n var storageType = (symbol != null) && symbol.IsStatic\n ? DkmEvaluationResultStorageType.Static\n : DkmEvaluationResultStorageType.None;\n\n var modifierFlags = DkmEvaluationResultTypeModifierFlags.None;\n if (isConstant)\n {\n modifierFlags = DkmEvaluationResultTypeModifierFlags.Constant;\n }\n else if (symbol is null)\n {\n // No change.\n }\n else if (symbol.IsVirtual || symbol.IsAbstract || symbol.IsOverride)\n {\n modifierFlags = DkmEvaluationResultTypeModifierFlags.Virtual;\n }\n else if (symbol.Kind == SymbolKind.Field && ((IFieldSymbolInternal)symbol).IsVolatile)\n {\n modifierFlags = DkmEvaluationResultTypeModifierFlags.Volatile;\n }\n\n // CONSIDER: for completeness, we could check for [MethodImpl(MethodImplOptions.Synchronized)]\n // and set DkmEvaluationResultTypeModifierFlags.Synchronized, but it doesn't seem to have any\n // impact on the UI. It is exposed through the DTE, but cscompee didn't set the flag either.\n\n return new ResultProperties(flags, category, accessType, storageType, modifierFlags);\n }\n\n private static DkmEvaluationResultCategory GetResultCategory(SymbolKind kind)\n {\n switch (kind)\n {\n case SymbolKind.Method:\n return DkmEvaluationResultCategory.Method;\n case SymbolKind.Property:\n return DkmEvaluationResultCategory.Property;\n default:\n return DkmEvaluationResultCategory.Data;\n }\n }\n\n private static DkmEvaluationResultAccessType GetResultAccessType(Accessibility accessibility)\n {\n switch (accessibility)\n {\n case Accessibility.Public:\n return DkmEvaluationResultAccessType.Public;\n case Accessibility.Protected:\n return DkmEvaluationResultAccessType.Protected;\n case Accessibility.Private:\n return DkmEvaluationResultAccessType.Private;\n case Accessibility.Internal:\n case Accessibility.ProtectedOrInternal: // Dev12 treats this as \"internal\"\n case Accessibility.ProtectedAndInternal: // Dev12 treats this as \"internal\"\n return DkmEvaluationResultAccessType.Internal;\n case Accessibility.NotApplicable:\n return DkmEvaluationResultAccessType.None;\n default:\n throw ExceptionUtilities.UnexpectedValue(accessibility);\n }\n }\n\n internal static bool Includes(this DkmVariableInfoFlags flags, DkmVariableInfoFlags desired)\n {\n return (flags & desired) == desired;\n }\n\n internal static MetadataContext GetMetadataContext(this DkmClrAppDomain appDomain)\n where TAssemblyContext : struct\n {\n var dataItem = appDomain.GetDataItem>>();\n return (dataItem == null) ? default : dataItem.MetadataContext;\n }\n\n internal static void SetMetadataContext(this DkmClrAppDomain appDomain, MetadataContext context, bool report)\n where TAssemblyContext : struct\n {\n if (report)\n {\n var process = appDomain.Process;\n var message = DkmUserMessage.Create(\n process.Connection,\n process,\n DkmUserMessageOutputKind.UnfilteredOutputWindowMessage,\n $\"EE: AppDomain {appDomain.Id}, blocks {context.MetadataBlocks.Length}, contexts {context.AssemblyContexts.Count}\" + Environment.NewLine,\n MessageBoxFlags.MB_OK,\n 0);\n message.Post();\n }\n appDomain.SetDataItem(DkmDataCreationDisposition.CreateAlways, new MetadataContextItem>(context));\n }\n\n internal static void RemoveMetadataContext(this DkmClrAppDomain appDomain)\n where TAssemblyContext : struct\n {\n appDomain.RemoveDataItem>();\n }\n\n private sealed class MetadataContextItem : DkmDataItem\n where TMetadataContext : struct\n {\n internal readonly TMetadataContext MetadataContext;\n\n internal MetadataContextItem(TMetadataContext metadataContext)\n {\n this.MetadataContext = metadataContext;\n }\n }\n\n private sealed class AppDomainLifetimeDataItem : DkmDataItem { }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Collections.ObjectModel;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Reflection.Metadata;\nusing Microsoft.CodeAnalysis.Debugging;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Symbols;\nusing Microsoft.VisualStudio.Debugger;\nusing Microsoft.VisualStudio.Debugger.Clr;\nusing Microsoft.VisualStudio.Debugger.Clr.NativeCompilation;\nusing Microsoft.VisualStudio.Debugger.Evaluation;\nusing Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.ExpressionEvaluator\n{\n internal static class DkmUtilities\n {\n internal unsafe delegate IntPtr GetMetadataBytesPtrFunction(AssemblyIdentity assemblyIdentity, out uint uSize);\n\n // Return the set of managed module instances from the AppDomain.\n private static IEnumerable GetModulesInAppDomain(this DkmClrRuntimeInstance runtime, DkmClrAppDomain appDomain)\n {\n if (appDomain.IsUnloaded)\n {\n return SpecializedCollections.EmptyEnumerable();\n }\n\n var appDomainId = appDomain.Id;\n // GetModuleInstances() may include instances of DkmClrNcContainerModuleInstance\n // which are containers of managed module instances (see GetEmbeddedModules())\n // but not managed modules themselves. Since GetModuleInstances() will include the\n // embedded modules, we can simply ignore DkmClrNcContainerModuleInstances.\n return runtime.GetModuleInstances().\n OfType().\n Where(module =>\n {\n var moduleAppDomain = module.AppDomain;\n return !moduleAppDomain.IsUnloaded && (moduleAppDomain.Id == appDomainId);\n });\n }\n\n internal static ImmutableArray GetMetadataBlocks(\n this DkmClrRuntimeInstance runtime,\n DkmClrAppDomain appDomain,\n ImmutableArray previousMetadataBlocks)\n {\n // Add a dummy data item to the appdomain to add it to the disposal queue when the debugged process is shutting down.\n // This should prevent from attempts to use the Metadata pointer for dead debugged processes.\n if (appDomain.GetDataItem() == null)\n {\n appDomain.SetDataItem(DkmDataCreationDisposition.CreateNew, new AppDomainLifetimeDataItem());\n }\n\n var builder = ArrayBuilder.GetInstance();\n IntPtr ptr;\n uint size;\n int index = 0;\n foreach (DkmClrModuleInstance module in runtime.GetModulesInAppDomain(appDomain))\n {\n MetadataBlock block;\n try\n {\n ptr = module.GetMetaDataBytesPtr(out size);\n Debug.Assert(size > 0);\n block = GetMetadataBlock(previousMetadataBlocks, index, ptr, size);\n }\n catch (NotImplementedException e) when (module is DkmClrNcModuleInstance)\n {\n // DkmClrNcModuleInstance.GetMetaDataBytesPtr not implemented in Dev14.\n throw new NotImplementedMetadataException(e);\n }\n catch (Exception e) when (DkmExceptionUtilities.IsBadOrMissingMetadataException(e))\n {\n continue;\n }\n Debug.Assert(block.ModuleVersionId == module.Mvid);\n builder.Add(block);\n index++;\n }\n // Include \"intrinsic method\" assembly.\n ptr = runtime.GetIntrinsicAssemblyMetaDataBytesPtr(out size);\n builder.Add(GetMetadataBlock(previousMetadataBlocks, index, ptr, size));\n return builder.ToImmutableAndFree();\n }\n\n internal static ImmutableArray GetMetadataBlocks(GetMetadataBytesPtrFunction getMetaDataBytesPtrFunction, ImmutableArray missingAssemblyIdentities)\n {\n ArrayBuilder? builder = null;\n foreach (var missingAssemblyIdentity in missingAssemblyIdentities)\n {\n MetadataBlock block;\n try\n {\n uint size;\n IntPtr ptr;\n ptr = getMetaDataBytesPtrFunction(missingAssemblyIdentity, out size);\n Debug.Assert(size > 0);\n block = GetMetadataBlock(ptr, size);\n }\n catch (Exception e) when (DkmExceptionUtilities.IsBadOrMissingMetadataException(e))\n {\n continue;\n }\n if (builder == null)\n {\n builder = ArrayBuilder.GetInstance();\n }\n builder.Add(block);\n }\n return builder == null ? ImmutableArray.Empty : builder.ToImmutableAndFree();\n }\n\n internal static ImmutableArray MakeAssemblyReaders(this DkmClrInstructionAddress instructionAddress)\n {\n var builder = ArrayBuilder.GetInstance();\n foreach (DkmClrModuleInstance module in instructionAddress.RuntimeInstance.GetModulesInAppDomain(instructionAddress.ModuleInstance.AppDomain))\n {\n var symReader = module.GetSymReader();\n if (symReader == null)\n {\n continue;\n }\n MetadataReader reader;\n unsafe\n {\n try\n {\n uint size;\n IntPtr ptr;\n ptr = module.GetMetaDataBytesPtr(out size);\n Debug.Assert(size > 0);\n reader = new MetadataReader((byte*)ptr, (int)size);\n }\n catch (Exception e) when (DkmExceptionUtilities.IsBadOrMissingMetadataException(e))\n {\n continue;\n }\n }\n builder.Add(new AssemblyReaders(reader, symReader));\n }\n return builder.ToImmutableAndFree();\n }\n\n private static unsafe MetadataBlock GetMetadataBlock(IntPtr ptr, uint size)\n {\n var reader = new MetadataReader((byte*)ptr, (int)size);\n var moduleDef = reader.GetModuleDefinition();\n var moduleVersionId = reader.GetGuid(moduleDef.Mvid);\n var generationId = reader.GetGuid(moduleDef.GenerationId);\n return new MetadataBlock(moduleVersionId, generationId, ptr, (int)size);\n }\n\n private static MetadataBlock GetMetadataBlock(ImmutableArray previousMetadataBlocks, int index, IntPtr ptr, uint size)\n {\n if (!previousMetadataBlocks.IsDefault && index < previousMetadataBlocks.Length)\n {\n var previousBlock = previousMetadataBlocks[index];\n if (previousBlock.Pointer == ptr && previousBlock.Size == size)\n {\n return previousBlock;\n }\n }\n\n return GetMetadataBlock(ptr, size);\n }\n\n internal static object? GetSymReader(this DkmClrModuleInstance clrModule)\n {\n var module = clrModule.Module; // Null if there are no symbols.\n if (module == null)\n {\n return null;\n }\n // Use DkmClrModuleInstance.GetSymUnmanagedReader()\n // rather than DkmModule.GetSymbolInterface() since the\n // latter does not handle .NET Native modules.\n return clrModule.GetSymUnmanagedReader();\n }\n\n internal static DkmCompiledClrInspectionQuery? ToQueryResult(\n this CompileResult? compResult,\n DkmCompilerId languageId,\n ResultProperties resultProperties,\n DkmClrRuntimeInstance runtimeInstance)\n {\n if (compResult == null)\n {\n return null;\n }\n\n Debug.Assert(compResult.Assembly != null);\n Debug.Assert(compResult.TypeName != null);\n Debug.Assert(compResult.MethodName != null);\n\n ReadOnlyCollection? customTypeInfo;\n Guid customTypeInfoId = compResult.GetCustomTypeInfo(out customTypeInfo);\n\n return DkmCompiledClrInspectionQuery.Create(\n runtimeInstance,\n Binary: new ReadOnlyCollection(compResult.Assembly),\n DataContainer: null,\n LanguageId: languageId,\n TypeName: compResult.TypeName,\n MethodName: compResult.MethodName,\n FormatSpecifiers: compResult.FormatSpecifiers,\n CompilationFlags: resultProperties.Flags,\n ResultCategory: resultProperties.Category,\n Access: resultProperties.AccessType,\n StorageType: resultProperties.StorageType,\n TypeModifierFlags: resultProperties.ModifierFlags,\n CustomTypeInfo: customTypeInfo.ToCustomTypeInfo(customTypeInfoId));\n }\n\n internal static DkmClrCustomTypeInfo? ToCustomTypeInfo(this ReadOnlyCollection? payload, Guid payloadTypeId)\n {\n return (payload == null) ? null : DkmClrCustomTypeInfo.Create(payloadTypeId, payload);\n }\n\n internal static ResultProperties GetResultProperties(this TSymbol? symbol, DkmClrCompilationResultFlags flags, bool isConstant)\n where TSymbol : class, ISymbolInternal\n {\n var category = (symbol != null) ? GetResultCategory(symbol.Kind)\n : DkmEvaluationResultCategory.Data;\n\n var accessType = (symbol != null) ? GetResultAccessType(symbol.DeclaredAccessibility)\n : DkmEvaluationResultAccessType.None;\n\n var storageType = (symbol != null) && symbol.IsStatic\n ? DkmEvaluationResultStorageType.Static\n : DkmEvaluationResultStorageType.None;\n\n var modifierFlags = DkmEvaluationResultTypeModifierFlags.None;\n if (isConstant)\n {\n modifierFlags = DkmEvaluationResultTypeModifierFlags.Constant;\n }\n else if (symbol is null)\n {\n // No change.\n }\n else if (symbol.IsVirtual || symbol.IsAbstract || symbol.IsOverride)\n {\n modifierFlags = DkmEvaluationResultTypeModifierFlags.Virtual;\n }\n else if (symbol.Kind == SymbolKind.Field && ((IFieldSymbolInternal)symbol).IsVolatile)\n {\n modifierFlags = DkmEvaluationResultTypeModifierFlags.Volatile;\n }\n\n // CONSIDER: for completeness, we could check for [MethodImpl(MethodImplOptions.Synchronized)]\n // and set DkmEvaluationResultTypeModifierFlags.Synchronized, but it doesn't seem to have any\n // impact on the UI. It is exposed through the DTE, but cscompee didn't set the flag either.\n\n return new ResultProperties(flags, category, accessType, storageType, modifierFlags);\n }\n\n private static DkmEvaluationResultCategory GetResultCategory(SymbolKind kind)\n {\n switch (kind)\n {\n case SymbolKind.Method:\n return DkmEvaluationResultCategory.Method;\n case SymbolKind.Property:\n return DkmEvaluationResultCategory.Property;\n default:\n return DkmEvaluationResultCategory.Data;\n }\n }\n\n private static DkmEvaluationResultAccessType GetResultAccessType(Accessibility accessibility)\n {\n switch (accessibility)\n {\n case Accessibility.Public:\n return DkmEvaluationResultAccessType.Public;\n case Accessibility.Protected:\n return DkmEvaluationResultAccessType.Protected;\n case Accessibility.Private:\n return DkmEvaluationResultAccessType.Private;\n case Accessibility.Internal:\n case Accessibility.ProtectedOrInternal: // Dev12 treats this as \"internal\"\n case Accessibility.ProtectedAndInternal: // Dev12 treats this as \"internal\"\n return DkmEvaluationResultAccessType.Internal;\n case Accessibility.NotApplicable:\n return DkmEvaluationResultAccessType.None;\n default:\n throw ExceptionUtilities.UnexpectedValue(accessibility);\n }\n }\n\n internal static bool Includes(this DkmVariableInfoFlags flags, DkmVariableInfoFlags desired)\n {\n return (flags & desired) == desired;\n }\n\n internal static MetadataContext GetMetadataContext(this DkmClrAppDomain appDomain)\n where TAssemblyContext : struct\n {\n var dataItem = appDomain.GetDataItem>>();\n return (dataItem == null) ? default : dataItem.MetadataContext;\n }\n\n internal static void SetMetadataContext(this DkmClrAppDomain appDomain, MetadataContext context, bool report)\n where TAssemblyContext : struct\n {\n if (report)\n {\n var process = appDomain.Process;\n var message = DkmUserMessage.Create(\n process.Connection,\n process,\n DkmUserMessageOutputKind.UnfilteredOutputWindowMessage,\n $\"EE: AppDomain {appDomain.Id}, blocks {context.MetadataBlocks.Length}, contexts {context.AssemblyContexts.Count}\" + Environment.NewLine,\n MessageBoxFlags.MB_OK,\n 0);\n message.Post();\n }\n appDomain.SetDataItem(DkmDataCreationDisposition.CreateAlways, new MetadataContextItem>(context));\n }\n\n internal static void RemoveMetadataContext(this DkmClrAppDomain appDomain)\n where TAssemblyContext : struct\n {\n appDomain.RemoveDataItem>();\n }\n\n private sealed class MetadataContextItem : DkmDataItem\n where TMetadataContext : struct\n {\n internal readonly TMetadataContext MetadataContext;\n\n internal MetadataContextItem(TMetadataContext metadataContext)\n {\n this.MetadataContext = metadataContext;\n }\n }\n\n private sealed class AppDomainLifetimeDataItem : DkmDataItem { }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":410,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Portable/Syntax/ArrayRankSpecifierSyntax.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nnamespace Microsoft.CodeAnalysis.CSharp.Syntax\n{\n public partial class ArrayRankSpecifierSyntax\n {\n public int Rank\n {\n get\n {\n return this.Sizes.Count;\n }\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nnamespace Microsoft.CodeAnalysis.CSharp.Syntax\n{\n public partial class ArrayRankSpecifierSyntax\n {\n public int Rank\n {\n get\n {\n return this.Sizes.Count;\n }\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":411,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Workspaces/Core/Portable/Serialization/SerializableSourceText.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.Host;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.Serialization\n{\n /// \n /// Represents a which can be serialized for sending to another process. The text is not\n /// required to be a live object in the current process, and can instead be held in temporary storage accessible by\n /// both processes.\n /// \n internal sealed class SerializableSourceText\n {\n /// \n /// The storage location for .\n /// \n /// \n /// Exactly one of or will be non-.\n /// \n public ITemporaryTextStorageWithName? Storage { get; }\n\n /// \n /// The in the current process.\n /// \n /// \n /// \n /// \n public SourceText? Text { get; }\n\n public SerializableSourceText(ITemporaryTextStorageWithName storage)\n : this(storage, text: null)\n {\n }\n\n public SerializableSourceText(SourceText text)\n : this(storage: null, text)\n {\n }\n\n private SerializableSourceText(ITemporaryTextStorageWithName? storage, SourceText? text)\n {\n Debug.Assert(storage is null != text is null);\n\n Storage = storage;\n Text = text;\n }\n\n public ImmutableArray GetChecksum()\n {\n return Text?.GetChecksum() ?? Storage!.GetChecksum();\n }\n\n public async ValueTask GetTextAsync(CancellationToken cancellationToken)\n {\n if (Text is not null)\n return Text;\n\n return await Storage!.ReadTextAsync(cancellationToken).ConfigureAwait(false);\n }\n\n public static ValueTask FromTextDocumentStateAsync(TextDocumentState state, CancellationToken cancellationToken)\n {\n if (state.Storage is ITemporaryTextStorageWithName storage)\n {\n return new ValueTask(new SerializableSourceText(storage));\n }\n else\n {\n return SpecializedTasks.TransformWithoutIntermediateCancellationExceptionAsync(\n static (state, cancellationToken) => state.GetTextAsync(cancellationToken),\n static (text, _) => new SerializableSourceText(text),\n state,\n cancellationToken);\n }\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.Host;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.Serialization\n{\n /// \n /// Represents a which can be serialized for sending to another process. The text is not\n /// required to be a live object in the current process, and can instead be held in temporary storage accessible by\n /// both processes.\n /// \n internal sealed class SerializableSourceText\n {\n /// \n /// The storage location for .\n /// \n /// \n /// Exactly one of or will be non-.\n /// \n public ITemporaryTextStorageWithName? Storage { get; }\n\n /// \n /// The in the current process.\n /// \n /// \n /// \n /// \n public SourceText? Text { get; }\n\n public SerializableSourceText(ITemporaryTextStorageWithName storage)\n : this(storage, text: null)\n {\n }\n\n public SerializableSourceText(SourceText text)\n : this(storage: null, text)\n {\n }\n\n private SerializableSourceText(ITemporaryTextStorageWithName? storage, SourceText? text)\n {\n Debug.Assert(storage is null != text is null);\n\n Storage = storage;\n Text = text;\n }\n\n public ImmutableArray GetChecksum()\n {\n return Text?.GetChecksum() ?? Storage!.GetChecksum();\n }\n\n public async ValueTask GetTextAsync(CancellationToken cancellationToken)\n {\n if (Text is not null)\n return Text;\n\n return await Storage!.ReadTextAsync(cancellationToken).ConfigureAwait(false);\n }\n\n public static ValueTask FromTextDocumentStateAsync(TextDocumentState state, CancellationToken cancellationToken)\n {\n if (state.Storage is ITemporaryTextStorageWithName storage)\n {\n return new ValueTask(new SerializableSourceText(storage));\n }\n else\n {\n return SpecializedTasks.TransformWithoutIntermediateCancellationExceptionAsync(\n static (state, cancellationToken) => state.GetTextAsync(cancellationToken),\n static (text, _) => new SerializableSourceText(text),\n state,\n cancellationToken);\n }\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":412,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Compilers/Test/Core/TempFiles/TempDirectory.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Diagnostics;\nusing System.IO;\n\nnamespace Microsoft.CodeAnalysis.Test.Utilities\n{\n public class TempDirectory\n {\n private readonly string _path;\n private readonly TempRoot _root;\n\n protected TempDirectory(TempRoot root)\n : this(CreateUniqueDirectory(TempRoot.Root), root)\n {\n }\n\n private TempDirectory(string path, TempRoot root)\n {\n Debug.Assert(path != null);\n Debug.Assert(root != null);\n\n _path = path;\n _root = root;\n }\n\n private static string CreateUniqueDirectory(string basePath)\n {\n while (true)\n {\n string dir = System.IO.Path.Combine(basePath, Guid.NewGuid().ToString());\n try\n {\n Directory.CreateDirectory(dir);\n return dir;\n }\n catch (IOException)\n {\n // retry\n }\n }\n }\n\n public string Path\n {\n get { return _path; }\n }\n\n /// \n /// Creates a file in this directory.\n /// \n /// File name.\n public TempFile CreateFile(string name)\n {\n string filePath = System.IO.Path.Combine(_path, name);\n TempRoot.CreateStream(filePath, FileMode.CreateNew);\n return _root.AddFile(new DisposableFile(filePath));\n }\n\n /// \n /// Creates a file or opens an existing file in this directory.\n /// \n public TempFile CreateOrOpenFile(string name)\n {\n string filePath = System.IO.Path.Combine(_path, name);\n TempRoot.CreateStream(filePath, FileMode.OpenOrCreate);\n return _root.AddFile(new DisposableFile(filePath));\n }\n\n /// \n /// Creates a file in this directory that is a copy of the specified file.\n /// \n public TempFile CopyFile(string originalPath, string name = null)\n {\n string filePath = System.IO.Path.Combine(_path, name ?? System.IO.Path.GetFileName(originalPath));\n File.Copy(originalPath, filePath);\n return _root.AddFile(new DisposableFile(filePath));\n }\n\n /// \n /// Creates a subdirectory in this directory.\n /// \n /// Directory name or unrooted directory path.\n public TempDirectory CreateDirectory(string name)\n {\n string dirPath = System.IO.Path.Combine(_path, name);\n Directory.CreateDirectory(dirPath);\n return new TempDirectory(dirPath, _root);\n }\n\n public override string ToString()\n {\n return _path;\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Diagnostics;\nusing System.IO;\n\nnamespace Microsoft.CodeAnalysis.Test.Utilities\n{\n public class TempDirectory\n {\n private readonly string _path;\n private readonly TempRoot _root;\n\n protected TempDirectory(TempRoot root)\n : this(CreateUniqueDirectory(TempRoot.Root), root)\n {\n }\n\n private TempDirectory(string path, TempRoot root)\n {\n Debug.Assert(path != null);\n Debug.Assert(root != null);\n\n _path = path;\n _root = root;\n }\n\n private static string CreateUniqueDirectory(string basePath)\n {\n while (true)\n {\n string dir = System.IO.Path.Combine(basePath, Guid.NewGuid().ToString());\n try\n {\n Directory.CreateDirectory(dir);\n return dir;\n }\n catch (IOException)\n {\n // retry\n }\n }\n }\n\n public string Path\n {\n get { return _path; }\n }\n\n /// \n /// Creates a file in this directory.\n /// \n /// File name.\n public TempFile CreateFile(string name)\n {\n string filePath = System.IO.Path.Combine(_path, name);\n TempRoot.CreateStream(filePath, FileMode.CreateNew);\n return _root.AddFile(new DisposableFile(filePath));\n }\n\n /// \n /// Creates a file or opens an existing file in this directory.\n /// \n public TempFile CreateOrOpenFile(string name)\n {\n string filePath = System.IO.Path.Combine(_path, name);\n TempRoot.CreateStream(filePath, FileMode.OpenOrCreate);\n return _root.AddFile(new DisposableFile(filePath));\n }\n\n /// \n /// Creates a file in this directory that is a copy of the specified file.\n /// \n public TempFile CopyFile(string originalPath, string name = null)\n {\n string filePath = System.IO.Path.Combine(_path, name ?? System.IO.Path.GetFileName(originalPath));\n File.Copy(originalPath, filePath);\n return _root.AddFile(new DisposableFile(filePath));\n }\n\n /// \n /// Creates a subdirectory in this directory.\n /// \n /// Directory name or unrooted directory path.\n public TempDirectory CreateDirectory(string name)\n {\n string dirPath = System.IO.Path.Combine(_path, name);\n Directory.CreateDirectory(dirPath);\n return new TempDirectory(dirPath, _root);\n }\n\n public override string ToString()\n {\n return _path;\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":413,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Features/CSharp/Portable/Completion/KeywordRecommenders/ReferenceKeywordRecommender.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Threading;\nusing Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders\n{\n internal class ReferenceKeywordRecommender : AbstractSyntacticSingleKeywordRecommender\n {\n public ReferenceKeywordRecommender()\n : base(SyntaxKind.ReferenceKeyword, isValidInPreprocessorContext: true)\n {\n }\n\n protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken)\n {\n var syntaxTree = context.SyntaxTree;\n return\n context.IsPreProcessorKeywordContext &&\n syntaxTree.IsScript() &&\n syntaxTree.IsBeforeFirstToken(position, cancellationToken);\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Threading;\nusing Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders\n{\n internal class ReferenceKeywordRecommender : AbstractSyntacticSingleKeywordRecommender\n {\n public ReferenceKeywordRecommender()\n : base(SyntaxKind.ReferenceKeyword, isValidInPreprocessorContext: true)\n {\n }\n\n protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken)\n {\n var syntaxTree = context.SyntaxTree;\n return\n context.IsPreProcessorKeywordContext &&\n syntaxTree.IsScript() &&\n syntaxTree.IsBeforeFirstToken(position, cancellationToken);\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":414,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/VisualStudio/CSharp/Impl/ObjectBrowser/ObjectBrowserLibraryManager.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.VisualStudio.ComponentModelHost;\nusing Microsoft.VisualStudio.LanguageServices.Implementation.Library.ObjectBrowser;\nusing Microsoft.VisualStudio.Shell.Interop;\n\nnamespace Microsoft.VisualStudio.LanguageServices.CSharp.ObjectBrowser\n{\n internal class ObjectBrowserLibraryManager : AbstractObjectBrowserLibraryManager\n {\n public ObjectBrowserLibraryManager(\n IServiceProvider serviceProvider,\n IComponentModel componentModel,\n VisualStudioWorkspace workspace)\n : base(LanguageNames.CSharp, Guids.CSharpLibraryId, serviceProvider, componentModel, workspace)\n {\n }\n\n internal override AbstractDescriptionBuilder CreateDescriptionBuilder(\n IVsObjectBrowserDescription3 description,\n ObjectListItem listItem,\n Project project)\n {\n return new DescriptionBuilder(description, this, listItem, project);\n }\n\n internal override AbstractListItemFactory CreateListItemFactory()\n => new ListItemFactory();\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.VisualStudio.ComponentModelHost;\nusing Microsoft.VisualStudio.LanguageServices.Implementation.Library.ObjectBrowser;\nusing Microsoft.VisualStudio.Shell.Interop;\n\nnamespace Microsoft.VisualStudio.LanguageServices.CSharp.ObjectBrowser\n{\n internal class ObjectBrowserLibraryManager : AbstractObjectBrowserLibraryManager\n {\n public ObjectBrowserLibraryManager(\n IServiceProvider serviceProvider,\n IComponentModel componentModel,\n VisualStudioWorkspace workspace)\n : base(LanguageNames.CSharp, Guids.CSharpLibraryId, serviceProvider, componentModel, workspace)\n {\n }\n\n internal override AbstractDescriptionBuilder CreateDescriptionBuilder(\n IVsObjectBrowserDescription3 description,\n ObjectListItem listItem,\n Project project)\n {\n return new DescriptionBuilder(description, this, listItem, project);\n }\n\n internal override AbstractListItemFactory CreateListItemFactory()\n => new ListItemFactory();\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":415,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Workspaces/Core/Portable/Shared/Utilities/BloomFilter.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\n\nnamespace Microsoft.CodeAnalysis.Shared.Utilities\n{\n internal partial class BloomFilter\n {\n // From MurmurHash:\n // 'm' and 'r' are mixing constants generated off-line.\n // The values for m and r are chosen through experimentation and \n // supported by evidence that they work well.\n private const uint Compute_Hash_m = 0x5bd1e995;\n private const int Compute_Hash_r = 24;\n\n private readonly BitArray _bitArray;\n private readonly int _hashFunctionCount;\n private readonly bool _isCaseSensitive;\n\n /// \n public BloomFilter(int expectedCount, double falsePositiveProbability, bool isCaseSensitive)\n {\n var m = Math.Max(1, ComputeM(expectedCount, falsePositiveProbability));\n var k = Math.Max(1, ComputeK(expectedCount, falsePositiveProbability));\n\n // We must have size in even bytes, so that when we deserialize from bytes we get a bit array with the same count.\n // The count is used by the hash functions.\n var sizeInEvenBytes = (m + 7) & ~7;\n\n _bitArray = new BitArray(length: sizeInEvenBytes);\n _hashFunctionCount = k;\n _isCaseSensitive = isCaseSensitive;\n }\n\n public BloomFilter(double falsePositiveProbability, bool isCaseSensitive, ICollection values)\n : this(values.Count, falsePositiveProbability, isCaseSensitive)\n {\n AddRange(values);\n }\n\n public BloomFilter(\n double falsePositiveProbability,\n ICollection stringValues,\n ICollection longValues)\n : this(stringValues.Count + longValues.Count, falsePositiveProbability, isCaseSensitive: false)\n {\n AddRange(stringValues);\n AddRange(longValues);\n }\n\n private BloomFilter(BitArray bitArray, int hashFunctionCount, bool isCaseSensitive)\n {\n _bitArray = bitArray ?? throw new ArgumentNullException(nameof(bitArray));\n _hashFunctionCount = hashFunctionCount;\n _isCaseSensitive = isCaseSensitive;\n }\n\n // m = ceil((n * log(p)) / log(1.0 / (pow(2.0, log(2.0)))))\n private static int ComputeM(int expectedCount, double falsePositiveProbability)\n {\n var p = falsePositiveProbability;\n double n = expectedCount;\n\n var numerator = n * Math.Log(p);\n var denominator = Math.Log(1.0 / Math.Pow(2.0, Math.Log(2.0)));\n return unchecked((int)Math.Ceiling(numerator / denominator));\n }\n\n // k = round(log(2.0) * m / n)\n private static int ComputeK(int expectedCount, double falsePositiveProbability)\n {\n double n = expectedCount;\n double m = ComputeM(expectedCount, falsePositiveProbability);\n\n var temp = Math.Log(2.0) * m / n;\n return unchecked((int)Math.Round(temp));\n }\n\n /// \n /// Modification of the murmurhash2 algorithm. Code is simpler because it operates over\n /// strings instead of byte arrays. Because each string character is two bytes, it is known\n /// that the input will be an even number of bytes (though not necessarily a multiple of 4).\n /// \n /// This is needed over the normal 'string.GetHashCode()' because we need to be able to generate\n /// 'k' different well distributed hashes for any given string s. Also, we want to be able to\n /// generate these hashes without allocating any memory. My ideal solution would be to use an\n /// MD5 hash. However, there appears to be no way to do MD5 in .NET where you can:\n /// \n /// a) feed it individual values instead of a byte[]\n /// \n /// b) have the hash computed into a byte[] you provide instead of a newly allocated one\n /// \n /// Generating 'k' pieces of garbage on each insert and lookup seems very wasteful. So,\n /// instead, we use murmur hash since it provides well distributed values, allows for a\n /// seed, and allocates no memory.\n /// \n /// Murmur hash is public domain. Actual code is included below as reference.\n /// \n private int ComputeHash(string key, int seed)\n {\n unchecked\n {\n // Initialize the hash to a 'random' value\n\n var numberOfCharsLeft = key.Length;\n var h = (uint)(seed ^ numberOfCharsLeft);\n\n // Mix 4 bytes at a time into the hash. NOTE: 4 bytes is two chars, so we iterate\n // through the string two chars at a time.\n var index = 0;\n while (numberOfCharsLeft >= 2)\n {\n var c1 = GetCharacter(key, index);\n var c2 = GetCharacter(key, index + 1);\n\n h = CombineTwoCharacters(h, c1, c2);\n\n index += 2;\n numberOfCharsLeft -= 2;\n }\n\n // Handle the last char (or 2 bytes) if they exist. This happens if the original string had\n // odd length.\n if (numberOfCharsLeft == 1)\n {\n var c = GetCharacter(key, index);\n h = CombineLastCharacter(h, c);\n }\n\n // Do a few final mixes of the hash to ensure the last few bytes are well-incorporated.\n\n h = FinalMix(h);\n\n return (int)h;\n }\n }\n\n private static int ComputeHash(long key, int seed)\n {\n // This is a duplicate of ComputeHash(string key, int seed). However, because\n // we only have 64bits to encode we just unroll that function here. See\n // Other function for documentation on what's going on here.\n unchecked\n {\n // Initialize the hash to a 'random' value\n\n var numberOfCharsLeft = 4;\n var h = (uint)(seed ^ numberOfCharsLeft);\n\n // Mix 4 bytes at a time into the hash. NOTE: 4 bytes is two chars, so we iterate\n // through the long two chars at a time.\n var index = 0;\n while (numberOfCharsLeft >= 2)\n {\n var c1 = GetCharacter(key, index);\n var c2 = GetCharacter(key, index + 1);\n\n h = CombineTwoCharacters(h, c1, c2);\n\n index += 2;\n numberOfCharsLeft -= 2;\n }\n\n Debug.Assert(numberOfCharsLeft == 0);\n\n // Do a few final mixes of the hash to ensure the last few bytes are well-incorporated.\n h = FinalMix(h);\n\n return (int)h;\n }\n }\n\n private static uint CombineLastCharacter(uint h, uint c)\n {\n unchecked\n {\n h ^= c;\n h *= Compute_Hash_m;\n return h;\n }\n }\n\n private static uint FinalMix(uint h)\n {\n unchecked\n {\n h ^= h >> 13;\n h *= Compute_Hash_m;\n h ^= h >> 15;\n return h;\n }\n }\n\n private static uint CombineTwoCharacters(uint h, uint c1, uint c2)\n {\n unchecked\n {\n var k = c1 | (c2 << 16);\n\n k *= Compute_Hash_m;\n k ^= k >> Compute_Hash_r;\n k *= Compute_Hash_m;\n\n h *= Compute_Hash_m;\n h ^= k;\n\n return h;\n }\n }\n\n private char GetCharacter(string key, int index)\n {\n var c = key[index];\n return _isCaseSensitive ? c : char.ToLowerInvariant(c);\n }\n\n private static char GetCharacter(long key, int index)\n {\n Debug.Assert(index <= 3);\n return (char)(key >> (16 * index));\n }\n\n#if false\n //-----------------------------------------------------------------------------\n // MurmurHash2, by Austin Appleby\n //\n // Note - This code makes a few assumptions about how your machine behaves -\n // 1. We can read a 4-byte value from any address without crashing\n // 2. sizeof(int) == 4\n //\n // And it has a few limitations -\n // 1. It will not work incrementally.\n // 2. It will not produce the same results on little-endian and big-endian\n // machines.\n unsigned int MurmurHash2(const void* key, int len, unsigned int seed)\n {\n // 'm' and 'r' are mixing constants generated offline.\n // The values for m and r are chosen through experimentation and \n // supported by evidence that they work well.\n \n const unsigned int m = 0x5bd1e995;\n const int r = 24;\n\n // Initialize the hash to a 'random' value\n unsigned int h = seed ^ len;\n\n // Mix 4 bytes at a time into the hash\n const unsigned char* data = (const unsigned char*)key;\n\n while(len >= 4)\n {\n unsigned int k = *(unsigned int*)data;\n\n k *= m; \n k ^= k >> r; \n k *= m; \n\n h *= m; \n h ^= k;\n\n data += 4;\n len -= 4;\n }\n \n // Handle the last few bytes of the input array\n switch(len)\n {\n case 3: h ^= data[2] << 16;\n case 2: h ^= data[1] << 8;\n case 1: h ^= data[0];\n h *= m;\n };\n\n // Do a few final mixes of the hash to ensure the last few\n // bytes are well-incorporated.\n\n h ^= h >> 13;\n h *= m;\n h ^= h >> 15;\n\n return h;\n } \n#endif\n\n public void AddRange(IEnumerable values)\n {\n foreach (var v in values)\n {\n Add(v);\n }\n }\n\n public void AddRange(IEnumerable values)\n {\n foreach (var v in values)\n {\n Add(v);\n }\n }\n\n public void Add(string value)\n {\n for (var i = 0; i < _hashFunctionCount; i++)\n {\n _bitArray[GetBitArrayIndex(value, i)] = true;\n }\n }\n\n private int GetBitArrayIndex(string value, int i)\n {\n var hash = ComputeHash(value, i);\n hash %= _bitArray.Length;\n return Math.Abs(hash);\n }\n\n public void Add(long value)\n {\n for (var i = 0; i < _hashFunctionCount; i++)\n {\n _bitArray[GetBitArrayIndex(value, i)] = true;\n }\n }\n\n private int GetBitArrayIndex(long value, int i)\n {\n var hash = ComputeHash(value, i);\n hash %= _bitArray.Length;\n return Math.Abs(hash);\n }\n\n public bool ProbablyContains(string value)\n {\n for (var i = 0; i < _hashFunctionCount; i++)\n {\n if (!_bitArray[GetBitArrayIndex(value, i)])\n {\n return false;\n }\n }\n\n return true;\n }\n\n public bool ProbablyContains(long value)\n {\n for (var i = 0; i < _hashFunctionCount; i++)\n {\n if (!_bitArray[GetBitArrayIndex(value, i)])\n {\n return false;\n }\n }\n\n return true;\n }\n\n public bool IsEquivalent(BloomFilter filter)\n {\n return IsEquivalent(_bitArray, filter._bitArray)\n && _hashFunctionCount == filter._hashFunctionCount\n && _isCaseSensitive == filter._isCaseSensitive;\n }\n\n private static bool IsEquivalent(BitArray array1, BitArray array2)\n {\n if (array1.Length != array2.Length)\n {\n return false;\n }\n\n for (var i = 0; i < array1.Length; i++)\n {\n if (array1[i] != array2[i])\n {\n return false;\n }\n }\n\n return true;\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\n\nnamespace Microsoft.CodeAnalysis.Shared.Utilities\n{\n internal partial class BloomFilter\n {\n // From MurmurHash:\n // 'm' and 'r' are mixing constants generated off-line.\n // The values for m and r are chosen through experimentation and \n // supported by evidence that they work well.\n private const uint Compute_Hash_m = 0x5bd1e995;\n private const int Compute_Hash_r = 24;\n\n private readonly BitArray _bitArray;\n private readonly int _hashFunctionCount;\n private readonly bool _isCaseSensitive;\n\n /// \n public BloomFilter(int expectedCount, double falsePositiveProbability, bool isCaseSensitive)\n {\n var m = Math.Max(1, ComputeM(expectedCount, falsePositiveProbability));\n var k = Math.Max(1, ComputeK(expectedCount, falsePositiveProbability));\n\n // We must have size in even bytes, so that when we deserialize from bytes we get a bit array with the same count.\n // The count is used by the hash functions.\n var sizeInEvenBytes = (m + 7) & ~7;\n\n _bitArray = new BitArray(length: sizeInEvenBytes);\n _hashFunctionCount = k;\n _isCaseSensitive = isCaseSensitive;\n }\n\n public BloomFilter(double falsePositiveProbability, bool isCaseSensitive, ICollection values)\n : this(values.Count, falsePositiveProbability, isCaseSensitive)\n {\n AddRange(values);\n }\n\n public BloomFilter(\n double falsePositiveProbability,\n ICollection stringValues,\n ICollection longValues)\n : this(stringValues.Count + longValues.Count, falsePositiveProbability, isCaseSensitive: false)\n {\n AddRange(stringValues);\n AddRange(longValues);\n }\n\n private BloomFilter(BitArray bitArray, int hashFunctionCount, bool isCaseSensitive)\n {\n _bitArray = bitArray ?? throw new ArgumentNullException(nameof(bitArray));\n _hashFunctionCount = hashFunctionCount;\n _isCaseSensitive = isCaseSensitive;\n }\n\n // m = ceil((n * log(p)) / log(1.0 / (pow(2.0, log(2.0)))))\n private static int ComputeM(int expectedCount, double falsePositiveProbability)\n {\n var p = falsePositiveProbability;\n double n = expectedCount;\n\n var numerator = n * Math.Log(p);\n var denominator = Math.Log(1.0 / Math.Pow(2.0, Math.Log(2.0)));\n return unchecked((int)Math.Ceiling(numerator / denominator));\n }\n\n // k = round(log(2.0) * m / n)\n private static int ComputeK(int expectedCount, double falsePositiveProbability)\n {\n double n = expectedCount;\n double m = ComputeM(expectedCount, falsePositiveProbability);\n\n var temp = Math.Log(2.0) * m / n;\n return unchecked((int)Math.Round(temp));\n }\n\n /// \n /// Modification of the murmurhash2 algorithm. Code is simpler because it operates over\n /// strings instead of byte arrays. Because each string character is two bytes, it is known\n /// that the input will be an even number of bytes (though not necessarily a multiple of 4).\n /// \n /// This is needed over the normal 'string.GetHashCode()' because we need to be able to generate\n /// 'k' different well distributed hashes for any given string s. Also, we want to be able to\n /// generate these hashes without allocating any memory. My ideal solution would be to use an\n /// MD5 hash. However, there appears to be no way to do MD5 in .NET where you can:\n /// \n /// a) feed it individual values instead of a byte[]\n /// \n /// b) have the hash computed into a byte[] you provide instead of a newly allocated one\n /// \n /// Generating 'k' pieces of garbage on each insert and lookup seems very wasteful. So,\n /// instead, we use murmur hash since it provides well distributed values, allows for a\n /// seed, and allocates no memory.\n /// \n /// Murmur hash is public domain. Actual code is included below as reference.\n /// \n private int ComputeHash(string key, int seed)\n {\n unchecked\n {\n // Initialize the hash to a 'random' value\n\n var numberOfCharsLeft = key.Length;\n var h = (uint)(seed ^ numberOfCharsLeft);\n\n // Mix 4 bytes at a time into the hash. NOTE: 4 bytes is two chars, so we iterate\n // through the string two chars at a time.\n var index = 0;\n while (numberOfCharsLeft >= 2)\n {\n var c1 = GetCharacter(key, index);\n var c2 = GetCharacter(key, index + 1);\n\n h = CombineTwoCharacters(h, c1, c2);\n\n index += 2;\n numberOfCharsLeft -= 2;\n }\n\n // Handle the last char (or 2 bytes) if they exist. This happens if the original string had\n // odd length.\n if (numberOfCharsLeft == 1)\n {\n var c = GetCharacter(key, index);\n h = CombineLastCharacter(h, c);\n }\n\n // Do a few final mixes of the hash to ensure the last few bytes are well-incorporated.\n\n h = FinalMix(h);\n\n return (int)h;\n }\n }\n\n private static int ComputeHash(long key, int seed)\n {\n // This is a duplicate of ComputeHash(string key, int seed). However, because\n // we only have 64bits to encode we just unroll that function here. See\n // Other function for documentation on what's going on here.\n unchecked\n {\n // Initialize the hash to a 'random' value\n\n var numberOfCharsLeft = 4;\n var h = (uint)(seed ^ numberOfCharsLeft);\n\n // Mix 4 bytes at a time into the hash. NOTE: 4 bytes is two chars, so we iterate\n // through the long two chars at a time.\n var index = 0;\n while (numberOfCharsLeft >= 2)\n {\n var c1 = GetCharacter(key, index);\n var c2 = GetCharacter(key, index + 1);\n\n h = CombineTwoCharacters(h, c1, c2);\n\n index += 2;\n numberOfCharsLeft -= 2;\n }\n\n Debug.Assert(numberOfCharsLeft == 0);\n\n // Do a few final mixes of the hash to ensure the last few bytes are well-incorporated.\n h = FinalMix(h);\n\n return (int)h;\n }\n }\n\n private static uint CombineLastCharacter(uint h, uint c)\n {\n unchecked\n {\n h ^= c;\n h *= Compute_Hash_m;\n return h;\n }\n }\n\n private static uint FinalMix(uint h)\n {\n unchecked\n {\n h ^= h >> 13;\n h *= Compute_Hash_m;\n h ^= h >> 15;\n return h;\n }\n }\n\n private static uint CombineTwoCharacters(uint h, uint c1, uint c2)\n {\n unchecked\n {\n var k = c1 | (c2 << 16);\n\n k *= Compute_Hash_m;\n k ^= k >> Compute_Hash_r;\n k *= Compute_Hash_m;\n\n h *= Compute_Hash_m;\n h ^= k;\n\n return h;\n }\n }\n\n private char GetCharacter(string key, int index)\n {\n var c = key[index];\n return _isCaseSensitive ? c : char.ToLowerInvariant(c);\n }\n\n private static char GetCharacter(long key, int index)\n {\n Debug.Assert(index <= 3);\n return (char)(key >> (16 * index));\n }\n\n#if false\n //-----------------------------------------------------------------------------\n // MurmurHash2, by Austin Appleby\n //\n // Note - This code makes a few assumptions about how your machine behaves -\n // 1. We can read a 4-byte value from any address without crashing\n // 2. sizeof(int) == 4\n //\n // And it has a few limitations -\n // 1. It will not work incrementally.\n // 2. It will not produce the same results on little-endian and big-endian\n // machines.\n unsigned int MurmurHash2(const void* key, int len, unsigned int seed)\n {\n // 'm' and 'r' are mixing constants generated offline.\n // The values for m and r are chosen through experimentation and \n // supported by evidence that they work well.\n \n const unsigned int m = 0x5bd1e995;\n const int r = 24;\n\n // Initialize the hash to a 'random' value\n unsigned int h = seed ^ len;\n\n // Mix 4 bytes at a time into the hash\n const unsigned char* data = (const unsigned char*)key;\n\n while(len >= 4)\n {\n unsigned int k = *(unsigned int*)data;\n\n k *= m; \n k ^= k >> r; \n k *= m; \n\n h *= m; \n h ^= k;\n\n data += 4;\n len -= 4;\n }\n \n // Handle the last few bytes of the input array\n switch(len)\n {\n case 3: h ^= data[2] << 16;\n case 2: h ^= data[1] << 8;\n case 1: h ^= data[0];\n h *= m;\n };\n\n // Do a few final mixes of the hash to ensure the last few\n // bytes are well-incorporated.\n\n h ^= h >> 13;\n h *= m;\n h ^= h >> 15;\n\n return h;\n } \n#endif\n\n public void AddRange(IEnumerable values)\n {\n foreach (var v in values)\n {\n Add(v);\n }\n }\n\n public void AddRange(IEnumerable values)\n {\n foreach (var v in values)\n {\n Add(v);\n }\n }\n\n public void Add(string value)\n {\n for (var i = 0; i < _hashFunctionCount; i++)\n {\n _bitArray[GetBitArrayIndex(value, i)] = true;\n }\n }\n\n private int GetBitArrayIndex(string value, int i)\n {\n var hash = ComputeHash(value, i);\n hash %= _bitArray.Length;\n return Math.Abs(hash);\n }\n\n public void Add(long value)\n {\n for (var i = 0; i < _hashFunctionCount; i++)\n {\n _bitArray[GetBitArrayIndex(value, i)] = true;\n }\n }\n\n private int GetBitArrayIndex(long value, int i)\n {\n var hash = ComputeHash(value, i);\n hash %= _bitArray.Length;\n return Math.Abs(hash);\n }\n\n public bool ProbablyContains(string value)\n {\n for (var i = 0; i < _hashFunctionCount; i++)\n {\n if (!_bitArray[GetBitArrayIndex(value, i)])\n {\n return false;\n }\n }\n\n return true;\n }\n\n public bool ProbablyContains(long value)\n {\n for (var i = 0; i < _hashFunctionCount; i++)\n {\n if (!_bitArray[GetBitArrayIndex(value, i)])\n {\n return false;\n }\n }\n\n return true;\n }\n\n public bool IsEquivalent(BloomFilter filter)\n {\n return IsEquivalent(_bitArray, filter._bitArray)\n && _hashFunctionCount == filter._hashFunctionCount\n && _isCaseSensitive == filter._isCaseSensitive;\n }\n\n private static bool IsEquivalent(BitArray array1, BitArray array2)\n {\n if (array1.Length != array2.Length)\n {\n return false;\n }\n\n for (var i = 0; i < array1.Length; i++)\n {\n if (array1[i] != array2[i])\n {\n return false;\n }\n }\n\n return true;\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":416,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/VisualStudio/Core/Def/Implementation/Progression/GraphQueries/ContainsGraphQuery.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.Text;\nusing Microsoft.VisualStudio.GraphModel;\nusing Microsoft.VisualStudio.GraphModel.Schemas;\n\nnamespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression\n{\n internal sealed class ContainsGraphQuery : IGraphQuery\n {\n public async Task GetGraphAsync(Solution solution, IGraphContext context, CancellationToken cancellationToken)\n {\n var graphBuilder = await GraphBuilder.CreateForInputNodesAsync(solution, context.InputNodes, cancellationToken).ConfigureAwait(false);\n var nodesToProcess = context.InputNodes;\n\n for (var depth = 0; depth < context.LinkDepth; depth++)\n {\n // This is the list of nodes we created and will process\n var newNodes = new HashSet();\n\n foreach (var node in nodesToProcess)\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n var symbol = graphBuilder.GetSymbol(node, cancellationToken);\n if (symbol != null)\n {\n foreach (var newSymbol in SymbolContainment.GetContainedSymbols(symbol))\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n var newNode = await graphBuilder.AddNodeAsync(\n newSymbol, relatedNode: node, cancellationToken).ConfigureAwait(false);\n graphBuilder.AddLink(node, GraphCommonSchema.Contains, newNode, cancellationToken);\n }\n }\n else if (node.HasCategory(CodeNodeCategories.File))\n {\n var document = graphBuilder.GetContextDocument(node, cancellationToken);\n if (document != null)\n {\n foreach (var newSymbol in await SymbolContainment.GetContainedSymbolsAsync(document, cancellationToken).ConfigureAwait(false))\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n var newNode = await graphBuilder.AddNodeAsync(\n newSymbol, relatedNode: node, cancellationToken).ConfigureAwait(false);\n graphBuilder.AddLink(node, GraphCommonSchema.Contains, newNode, cancellationToken);\n }\n }\n }\n }\n\n nodesToProcess = newNodes;\n }\n\n return graphBuilder;\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.Text;\nusing Microsoft.VisualStudio.GraphModel;\nusing Microsoft.VisualStudio.GraphModel.Schemas;\n\nnamespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression\n{\n internal sealed class ContainsGraphQuery : IGraphQuery\n {\n public async Task GetGraphAsync(Solution solution, IGraphContext context, CancellationToken cancellationToken)\n {\n var graphBuilder = await GraphBuilder.CreateForInputNodesAsync(solution, context.InputNodes, cancellationToken).ConfigureAwait(false);\n var nodesToProcess = context.InputNodes;\n\n for (var depth = 0; depth < context.LinkDepth; depth++)\n {\n // This is the list of nodes we created and will process\n var newNodes = new HashSet();\n\n foreach (var node in nodesToProcess)\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n var symbol = graphBuilder.GetSymbol(node, cancellationToken);\n if (symbol != null)\n {\n foreach (var newSymbol in SymbolContainment.GetContainedSymbols(symbol))\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n var newNode = await graphBuilder.AddNodeAsync(\n newSymbol, relatedNode: node, cancellationToken).ConfigureAwait(false);\n graphBuilder.AddLink(node, GraphCommonSchema.Contains, newNode, cancellationToken);\n }\n }\n else if (node.HasCategory(CodeNodeCategories.File))\n {\n var document = graphBuilder.GetContextDocument(node, cancellationToken);\n if (document != null)\n {\n foreach (var newSymbol in await SymbolContainment.GetContainedSymbolsAsync(document, cancellationToken).ConfigureAwait(false))\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n var newNode = await graphBuilder.AddNodeAsync(\n newSymbol, relatedNode: node, cancellationToken).ConfigureAwait(false);\n graphBuilder.AddLink(node, GraphCommonSchema.Contains, newNode, cancellationToken);\n }\n }\n }\n }\n\n nodesToProcess = newNodes;\n }\n\n return graphBuilder;\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":417,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Features/Core/Portable/NavigateTo/IRemoteNavigateToSearchService.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Immutable;\nusing System.Composition;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.CodeAnalysis.Remote;\nusing Microsoft.CodeAnalysis.Storage;\n\nnamespace Microsoft.CodeAnalysis.NavigateTo\n{\n internal interface IRemoteNavigateToSearchService\n {\n ValueTask SearchFullyLoadedDocumentAsync(PinnedSolutionInfo solutionInfo, DocumentId documentId, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken);\n ValueTask SearchFullyLoadedProjectAsync(PinnedSolutionInfo solutionInfo, ProjectId projectId, ImmutableArray priorityDocumentIds, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken);\n ValueTask SearchCachedDocumentsAsync(ImmutableArray documentKeys, ImmutableArray priorityDocumentKeys, StorageDatabase database, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken);\n ValueTask HydrateAsync(PinnedSolutionInfo solutionInfo, CancellationToken cancellationToken);\n\n public interface ICallback\n {\n ValueTask OnResultFoundAsync(RemoteServiceCallbackId callbackId, RoslynNavigateToItem result);\n }\n }\n\n [ExportRemoteServiceCallbackDispatcher(typeof(IRemoteNavigateToSearchService)), Shared]\n internal sealed class NavigateToSearchServiceServerCallbackDispatcher : RemoteServiceCallbackDispatcher, IRemoteNavigateToSearchService.ICallback\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public NavigateToSearchServiceServerCallbackDispatcher()\n {\n }\n\n private new NavigateToSearchServiceCallback GetCallback(RemoteServiceCallbackId callbackId)\n => (NavigateToSearchServiceCallback)base.GetCallback(callbackId);\n\n public ValueTask OnResultFoundAsync(RemoteServiceCallbackId callbackId, RoslynNavigateToItem result)\n => GetCallback(callbackId).OnResultFoundAsync(result);\n }\n\n internal sealed class NavigateToSearchServiceCallback\n {\n private readonly Func _onResultFound;\n\n public NavigateToSearchServiceCallback(Func onResultFound)\n {\n _onResultFound = onResultFound;\n }\n\n public async ValueTask OnResultFoundAsync(RoslynNavigateToItem result)\n => await _onResultFound(result).ConfigureAwait(false);\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Immutable;\nusing System.Composition;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.CodeAnalysis.Remote;\nusing Microsoft.CodeAnalysis.Storage;\n\nnamespace Microsoft.CodeAnalysis.NavigateTo\n{\n internal interface IRemoteNavigateToSearchService\n {\n ValueTask SearchFullyLoadedDocumentAsync(PinnedSolutionInfo solutionInfo, DocumentId documentId, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken);\n ValueTask SearchFullyLoadedProjectAsync(PinnedSolutionInfo solutionInfo, ProjectId projectId, ImmutableArray priorityDocumentIds, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken);\n ValueTask SearchCachedDocumentsAsync(ImmutableArray documentKeys, ImmutableArray priorityDocumentKeys, StorageDatabase database, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken);\n ValueTask HydrateAsync(PinnedSolutionInfo solutionInfo, CancellationToken cancellationToken);\n\n public interface ICallback\n {\n ValueTask OnResultFoundAsync(RemoteServiceCallbackId callbackId, RoslynNavigateToItem result);\n }\n }\n\n [ExportRemoteServiceCallbackDispatcher(typeof(IRemoteNavigateToSearchService)), Shared]\n internal sealed class NavigateToSearchServiceServerCallbackDispatcher : RemoteServiceCallbackDispatcher, IRemoteNavigateToSearchService.ICallback\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public NavigateToSearchServiceServerCallbackDispatcher()\n {\n }\n\n private new NavigateToSearchServiceCallback GetCallback(RemoteServiceCallbackId callbackId)\n => (NavigateToSearchServiceCallback)base.GetCallback(callbackId);\n\n public ValueTask OnResultFoundAsync(RemoteServiceCallbackId callbackId, RoslynNavigateToItem result)\n => GetCallback(callbackId).OnResultFoundAsync(result);\n }\n\n internal sealed class NavigateToSearchServiceCallback\n {\n private readonly Func _onResultFound;\n\n public NavigateToSearchServiceCallback(Func onResultFound)\n {\n _onResultFound = onResultFound;\n }\n\n public async ValueTask OnResultFoundAsync(RoslynNavigateToItem result)\n => await _onResultFound(result).ConfigureAwait(false);\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":418,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/VisualStudio/Core/Def/Implementation/ProjectSystem/TextEditApplication.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Collections.Immutable;\nusing Microsoft.CodeAnalysis.Editor.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Editor.Undo;\nusing Microsoft.CodeAnalysis.Text;\nusing Microsoft.VisualStudio.Text;\n\nnamespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem\n{\n internal static class TextEditApplication\n {\n internal static void UpdateText(SourceText newText, ITextBuffer buffer, EditOptions options)\n {\n var oldSnapshot = buffer.CurrentSnapshot;\n var oldText = oldSnapshot.AsText();\n var changes = newText.GetTextChanges(oldText);\n UpdateText(changes.ToImmutableArray(), buffer, oldSnapshot, oldText, options);\n }\n\n public static void UpdateText(ImmutableArray textChanges, ITextBuffer buffer, EditOptions options)\n {\n var oldSnapshot = buffer.CurrentSnapshot;\n var oldText = oldSnapshot.AsText();\n\n UpdateText(textChanges, buffer, oldSnapshot, oldText, options);\n }\n\n private static void UpdateText(ImmutableArray textChanges, ITextBuffer buffer, ITextSnapshot oldSnapshot, SourceText oldText, EditOptions options)\n {\n using var edit = buffer.CreateEdit(options, reiteratedVersionNumber: null, editTag: null);\n if (CodeAnalysis.Workspace.TryGetWorkspace(oldText.Container, out var workspace))\n {\n var undoService = workspace.Services.GetRequiredService();\n undoService.BeginUndoTransaction(oldSnapshot);\n }\n\n foreach (var change in textChanges)\n {\n edit.Replace(change.Span.Start, change.Span.Length, change.NewText);\n }\n\n edit.ApplyAndLogExceptions();\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Collections.Immutable;\nusing Microsoft.CodeAnalysis.Editor.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Editor.Undo;\nusing Microsoft.CodeAnalysis.Text;\nusing Microsoft.VisualStudio.Text;\n\nnamespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem\n{\n internal static class TextEditApplication\n {\n internal static void UpdateText(SourceText newText, ITextBuffer buffer, EditOptions options)\n {\n var oldSnapshot = buffer.CurrentSnapshot;\n var oldText = oldSnapshot.AsText();\n var changes = newText.GetTextChanges(oldText);\n UpdateText(changes.ToImmutableArray(), buffer, oldSnapshot, oldText, options);\n }\n\n public static void UpdateText(ImmutableArray textChanges, ITextBuffer buffer, EditOptions options)\n {\n var oldSnapshot = buffer.CurrentSnapshot;\n var oldText = oldSnapshot.AsText();\n\n UpdateText(textChanges, buffer, oldSnapshot, oldText, options);\n }\n\n private static void UpdateText(ImmutableArray textChanges, ITextBuffer buffer, ITextSnapshot oldSnapshot, SourceText oldText, EditOptions options)\n {\n using var edit = buffer.CreateEdit(options, reiteratedVersionNumber: null, editTag: null);\n if (CodeAnalysis.Workspace.TryGetWorkspace(oldText.Container, out var workspace))\n {\n var undoService = workspace.Services.GetRequiredService();\n undoService.BeginUndoTransaction(oldSnapshot);\n }\n\n foreach (var change in textChanges)\n {\n edit.Replace(change.Span.Start, change.Span.Length, change.NewText);\n }\n\n edit.ApplyAndLogExceptions();\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":419,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Tools/IdeCoreBenchmarks/FormatterBenchmarks.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Immutable;\nusing System.IO;\nusing System.Threading;\nusing BenchmarkDotNet.Attributes;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp.Formatting;\nusing Microsoft.CodeAnalysis.Formatting;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.CodeAnalysis.Options;\n\nnamespace IdeCoreBenchmarks\n{\n [MemoryDiagnoser]\n public class FormatterBenchmarks\n {\n private readonly int _iterationCount = 5;\n\n private Document _document;\n private OptionSet _options;\n\n [GlobalSetup]\n public void GlobalSetup()\n {\n var roslynRoot = Environment.GetEnvironmentVariable(Program.RoslynRootPathEnvVariableName);\n var csFilePath = Path.Combine(roslynRoot, @\"src\\Compilers\\CSharp\\Portable\\Generated\\Syntax.xml.Syntax.Generated.cs\");\n\n if (!File.Exists(csFilePath))\n {\n throw new ArgumentException();\n }\n\n // Remove some newlines\n var text = File.ReadAllText(csFilePath).Replace(\"\", \"\")\n .Replace($\"{{{Environment.NewLine}{Environment.NewLine}\", \"{\")\n .Replace($\"}}{Environment.NewLine}{Environment.NewLine}\", \"}\")\n .Replace($\"{{{Environment.NewLine}\", \"{\")\n .Replace($\"}}{Environment.NewLine}\", \"}\")\n .Replace($\";{Environment.NewLine}\", \";\");\n\n var projectId = ProjectId.CreateNewId();\n var documentId = DocumentId.CreateNewId(projectId);\n\n var solution = new AdhocWorkspace().CurrentSolution\n .AddProject(projectId, \"ProjectName\", \"AssemblyName\", LanguageNames.CSharp)\n .AddDocument(documentId, \"DocumentName\", text);\n\n var document = solution.GetDocument(documentId);\n var root = document.GetSyntaxRootAsync(CancellationToken.None).Result.WithAdditionalAnnotations(Formatter.Annotation);\n solution = solution.WithDocumentSyntaxRoot(documentId, root);\n\n _document = solution.GetDocument(documentId);\n _options = _document.GetOptionsAsync().Result\n .WithChangedOption(CSharpFormattingOptions.NewLinesForBracesInTypes, true)\n .WithChangedOption(CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine, false)\n .WithChangedOption(CSharpFormattingOptions.WrappingPreserveSingleLine, false);\n }\n\n [Benchmark]\n public void FormatSyntaxNode()\n {\n for (int i = 0; i < _iterationCount; ++i)\n {\n var formattedDoc = Formatter.FormatAsync(_document, Formatter.Annotation, _options, CancellationToken.None).Result;\n var formattedRoot = formattedDoc.GetSyntaxRootAsync(CancellationToken.None).Result;\n _ = formattedRoot.DescendantNodesAndSelf().ToImmutableArray();\n }\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Immutable;\nusing System.IO;\nusing System.Threading;\nusing BenchmarkDotNet.Attributes;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp.Formatting;\nusing Microsoft.CodeAnalysis.Formatting;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.CodeAnalysis.Options;\n\nnamespace IdeCoreBenchmarks\n{\n [MemoryDiagnoser]\n public class FormatterBenchmarks\n {\n private readonly int _iterationCount = 5;\n\n private Document _document;\n private OptionSet _options;\n\n [GlobalSetup]\n public void GlobalSetup()\n {\n var roslynRoot = Environment.GetEnvironmentVariable(Program.RoslynRootPathEnvVariableName);\n var csFilePath = Path.Combine(roslynRoot, @\"src\\Compilers\\CSharp\\Portable\\Generated\\Syntax.xml.Syntax.Generated.cs\");\n\n if (!File.Exists(csFilePath))\n {\n throw new ArgumentException();\n }\n\n // Remove some newlines\n var text = File.ReadAllText(csFilePath).Replace(\"\", \"\")\n .Replace($\"{{{Environment.NewLine}{Environment.NewLine}\", \"{\")\n .Replace($\"}}{Environment.NewLine}{Environment.NewLine}\", \"}\")\n .Replace($\"{{{Environment.NewLine}\", \"{\")\n .Replace($\"}}{Environment.NewLine}\", \"}\")\n .Replace($\";{Environment.NewLine}\", \";\");\n\n var projectId = ProjectId.CreateNewId();\n var documentId = DocumentId.CreateNewId(projectId);\n\n var solution = new AdhocWorkspace().CurrentSolution\n .AddProject(projectId, \"ProjectName\", \"AssemblyName\", LanguageNames.CSharp)\n .AddDocument(documentId, \"DocumentName\", text);\n\n var document = solution.GetDocument(documentId);\n var root = document.GetSyntaxRootAsync(CancellationToken.None).Result.WithAdditionalAnnotations(Formatter.Annotation);\n solution = solution.WithDocumentSyntaxRoot(documentId, root);\n\n _document = solution.GetDocument(documentId);\n _options = _document.GetOptionsAsync().Result\n .WithChangedOption(CSharpFormattingOptions.NewLinesForBracesInTypes, true)\n .WithChangedOption(CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine, false)\n .WithChangedOption(CSharpFormattingOptions.WrappingPreserveSingleLine, false);\n }\n\n [Benchmark]\n public void FormatSyntaxNode()\n {\n for (int i = 0; i < _iterationCount; ++i)\n {\n var formattedDoc = Formatter.FormatAsync(_document, Formatter.Annotation, _options, CancellationToken.None).Result;\n var formattedRoot = formattedDoc.GetSyntaxRootAsync(CancellationToken.None).Result;\n _ = formattedRoot.DescendantNodesAndSelf().ToImmutableArray();\n }\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":420,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Portable/Errors/XmlSyntaxDiagnosticInfo.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Globalization;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp\n{\n internal sealed class XmlSyntaxDiagnosticInfo : SyntaxDiagnosticInfo\n {\n static XmlSyntaxDiagnosticInfo()\n {\n ObjectBinder.RegisterTypeReader(typeof(XmlSyntaxDiagnosticInfo), r => new XmlSyntaxDiagnosticInfo(r));\n }\n\n private readonly XmlParseErrorCode _xmlErrorCode;\n\n internal XmlSyntaxDiagnosticInfo(XmlParseErrorCode code, params object[] args)\n : this(0, 0, code, args)\n {\n }\n\n internal XmlSyntaxDiagnosticInfo(int offset, int width, XmlParseErrorCode code, params object[] args)\n : base(offset, width, ErrorCode.WRN_XMLParseError, args)\n {\n _xmlErrorCode = code;\n }\n\n #region Serialization\n\n protected override void WriteTo(ObjectWriter writer)\n {\n base.WriteTo(writer);\n writer.WriteUInt32((uint)_xmlErrorCode);\n }\n\n private XmlSyntaxDiagnosticInfo(ObjectReader reader)\n : base(reader)\n {\n _xmlErrorCode = (XmlParseErrorCode)reader.ReadUInt32();\n }\n\n #endregion\n\n public override string GetMessage(IFormatProvider formatProvider = null)\n {\n var culture = formatProvider as CultureInfo;\n\n string messagePrefix = this.MessageProvider.LoadMessage(this.Code, culture);\n string message = ErrorFacts.GetMessage(_xmlErrorCode, culture);\n\n System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(message));\n\n if (this.Arguments == null || this.Arguments.Length == 0)\n {\n return String.Format(formatProvider, messagePrefix, message);\n }\n\n return String.Format(formatProvider, String.Format(formatProvider, messagePrefix, message), GetArgumentsToUse(formatProvider));\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Globalization;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp\n{\n internal sealed class XmlSyntaxDiagnosticInfo : SyntaxDiagnosticInfo\n {\n static XmlSyntaxDiagnosticInfo()\n {\n ObjectBinder.RegisterTypeReader(typeof(XmlSyntaxDiagnosticInfo), r => new XmlSyntaxDiagnosticInfo(r));\n }\n\n private readonly XmlParseErrorCode _xmlErrorCode;\n\n internal XmlSyntaxDiagnosticInfo(XmlParseErrorCode code, params object[] args)\n : this(0, 0, code, args)\n {\n }\n\n internal XmlSyntaxDiagnosticInfo(int offset, int width, XmlParseErrorCode code, params object[] args)\n : base(offset, width, ErrorCode.WRN_XMLParseError, args)\n {\n _xmlErrorCode = code;\n }\n\n #region Serialization\n\n protected override void WriteTo(ObjectWriter writer)\n {\n base.WriteTo(writer);\n writer.WriteUInt32((uint)_xmlErrorCode);\n }\n\n private XmlSyntaxDiagnosticInfo(ObjectReader reader)\n : base(reader)\n {\n _xmlErrorCode = (XmlParseErrorCode)reader.ReadUInt32();\n }\n\n #endregion\n\n public override string GetMessage(IFormatProvider formatProvider = null)\n {\n var culture = formatProvider as CultureInfo;\n\n string messagePrefix = this.MessageProvider.LoadMessage(this.Code, culture);\n string message = ErrorFacts.GetMessage(_xmlErrorCode, culture);\n\n System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(message));\n\n if (this.Arguments == null || this.Arguments.Length == 0)\n {\n return String.Format(formatProvider, messagePrefix, message);\n }\n\n return String.Format(formatProvider, String.Format(formatProvider, messagePrefix, message), GetArgumentsToUse(formatProvider));\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":421,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/SymbolEquivalenceComparer.GetHashCodeVisitor.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Linq;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.Shared.Utilities\n{\n internal partial class SymbolEquivalenceComparer\n {\n private class GetHashCodeVisitor\n {\n private readonly SymbolEquivalenceComparer _symbolEquivalenceComparer;\n private readonly bool _compareMethodTypeParametersByIndex;\n private readonly bool _objectAndDynamicCompareEqually;\n private readonly Func _parameterAggregator;\n private readonly Func _symbolAggregator;\n\n public GetHashCodeVisitor(\n SymbolEquivalenceComparer symbolEquivalenceComparer,\n bool compareMethodTypeParametersByIndex,\n bool objectAndDynamicCompareEqually)\n {\n _symbolEquivalenceComparer = symbolEquivalenceComparer;\n _compareMethodTypeParametersByIndex = compareMethodTypeParametersByIndex;\n _objectAndDynamicCompareEqually = objectAndDynamicCompareEqually;\n _parameterAggregator = (acc, sym) => Hash.Combine(symbolEquivalenceComparer.ParameterEquivalenceComparer.GetHashCode(sym), acc);\n _symbolAggregator = (acc, sym) => GetHashCode(sym, acc);\n }\n\n public int GetHashCode(ISymbol? x, int currentHash)\n {\n if (x == null)\n return 0;\n\n x = UnwrapAlias(x);\n\n // Special case. If we're comparing signatures then we want to compare 'object'\n // and 'dynamic' as the same. However, since they're different types, we don't\n // want to bail out using the above check.\n\n if (x.Kind == SymbolKind.DynamicType ||\n (_objectAndDynamicCompareEqually && IsObjectType(x)))\n {\n return Hash.Combine(GetNullableAnnotationsHashCode((ITypeSymbol)x), Hash.Combine(typeof(IDynamicTypeSymbol), currentHash));\n }\n\n return GetHashCodeWorker(x, currentHash);\n }\n\n private int GetNullableAnnotationsHashCode(ITypeSymbol type)\n => _symbolEquivalenceComparer._ignoreNullableAnnotations ? 0 : type.NullableAnnotation.GetHashCode();\n\n private int GetHashCodeWorker(ISymbol x, int currentHash)\n => x.Kind switch\n {\n SymbolKind.ArrayType => CombineHashCodes((IArrayTypeSymbol)x, currentHash),\n SymbolKind.Assembly => CombineHashCodes((IAssemblySymbol)x, currentHash),\n SymbolKind.Event => CombineHashCodes((IEventSymbol)x, currentHash),\n SymbolKind.Field => CombineHashCodes((IFieldSymbol)x, currentHash),\n SymbolKind.Label => CombineHashCodes((ILabelSymbol)x, currentHash),\n SymbolKind.Local => CombineHashCodes((ILocalSymbol)x, currentHash),\n SymbolKind.Method => CombineHashCodes((IMethodSymbol)x, currentHash),\n SymbolKind.NetModule => CombineHashCodes((IModuleSymbol)x, currentHash),\n SymbolKind.NamedType => CombineHashCodes((INamedTypeSymbol)x, currentHash),\n SymbolKind.Namespace => CombineHashCodes((INamespaceSymbol)x, currentHash),\n SymbolKind.Parameter => CombineHashCodes((IParameterSymbol)x, currentHash),\n SymbolKind.PointerType => CombineHashCodes((IPointerTypeSymbol)x, currentHash),\n SymbolKind.Property => CombineHashCodes((IPropertySymbol)x, currentHash),\n SymbolKind.RangeVariable => CombineHashCodes((IRangeVariableSymbol)x, currentHash),\n SymbolKind.TypeParameter => CombineHashCodes((ITypeParameterSymbol)x, currentHash),\n SymbolKind.Preprocessing => CombineHashCodes((IPreprocessingSymbol)x, currentHash),\n _ => -1,\n };\n\n private int CombineHashCodes(IArrayTypeSymbol x, int currentHash)\n {\n return\n Hash.Combine(GetNullableAnnotationsHashCode(x),\n Hash.Combine(x.Rank,\n GetHashCode(x.ElementType, currentHash)));\n }\n\n private int CombineHashCodes(IAssemblySymbol x, int currentHash)\n => Hash.Combine(_symbolEquivalenceComparer._assemblyComparerOpt?.GetHashCode(x) ?? 0, currentHash);\n\n private int CombineHashCodes(IFieldSymbol x, int currentHash)\n {\n return\n Hash.Combine(x.Name,\n GetHashCode(x.ContainingSymbol, currentHash));\n }\n\n private static int CombineHashCodes(ILabelSymbol x, int currentHash)\n {\n return\n Hash.Combine(x.Name,\n Hash.Combine(x.Locations.FirstOrDefault(), currentHash));\n }\n\n private static int CombineHashCodes(ILocalSymbol x, int currentHash)\n => Hash.Combine(x.Locations.FirstOrDefault(), currentHash);\n\n private static int CombineHashCodes(ImmutableArray array, int currentHash, Func func)\n => array.Aggregate(currentHash, func);\n\n private int CombineHashCodes(IMethodSymbol x, int currentHash)\n {\n currentHash = Hash.Combine(x.MetadataName, currentHash);\n if (x.MethodKind == MethodKind.AnonymousFunction)\n {\n return Hash.Combine(x.Locations.FirstOrDefault(), currentHash);\n }\n\n currentHash =\n Hash.Combine(IsPartialMethodImplementationPart(x),\n Hash.Combine(IsPartialMethodDefinitionPart(x),\n Hash.Combine(x.IsDefinition,\n Hash.Combine(IsConstructedFromSelf(x),\n Hash.Combine(x.Arity,\n Hash.Combine(x.Parameters.Length,\n Hash.Combine(x.Name, currentHash)))))));\n\n var checkContainingType = CheckContainingType(x);\n if (checkContainingType)\n {\n currentHash = GetHashCode(x.ContainingSymbol, currentHash);\n }\n\n currentHash =\n CombineHashCodes(x.Parameters, currentHash, _parameterAggregator);\n\n return IsConstructedFromSelf(x)\n ? currentHash\n : CombineHashCodes(x.TypeArguments, currentHash, _symbolAggregator);\n }\n\n private int CombineHashCodes(IModuleSymbol x, int currentHash)\n => CombineHashCodes(x.ContainingAssembly, Hash.Combine(x.Name, currentHash));\n\n private int CombineHashCodes(INamedTypeSymbol x, int currentHash)\n {\n currentHash = CombineNamedTypeHashCode(x, currentHash);\n\n if (x is IErrorTypeSymbol errorType)\n {\n foreach (var candidate in errorType.CandidateSymbols)\n {\n if (candidate is INamedTypeSymbol candidateNamedType)\n {\n currentHash = CombineNamedTypeHashCode(candidateNamedType, currentHash);\n }\n }\n }\n\n return currentHash;\n }\n\n private int CombineNamedTypeHashCode(INamedTypeSymbol x, int currentHash)\n {\n if (x.IsTupleType)\n {\n return Hash.Combine(currentHash, Hash.CombineValues(x.TupleElements));\n }\n\n // If we want object and dynamic to be the same, and this is 'object', then return\n // the same hash we do for 'dynamic'.\n currentHash =\n Hash.Combine((int)GetTypeKind(x),\n Hash.Combine(IsConstructedFromSelf(x),\n Hash.Combine(x.Arity,\n Hash.Combine(x.Name,\n Hash.Combine(x.IsAnonymousType,\n Hash.Combine(x.IsUnboundGenericType,\n Hash.Combine(GetNullableAnnotationsHashCode(x),\n GetHashCode(x.ContainingSymbol, currentHash))))))));\n\n if (x.IsAnonymousType)\n {\n return CombineAnonymousTypeHashCode(x, currentHash);\n }\n\n return IsConstructedFromSelf(x) || x.IsUnboundGenericType\n ? currentHash\n : CombineHashCodes(x.TypeArguments, currentHash, _symbolAggregator);\n }\n\n private int CombineAnonymousTypeHashCode(INamedTypeSymbol x, int currentHash)\n {\n if (x.TypeKind == TypeKind.Delegate)\n {\n return GetHashCode(x.DelegateInvokeMethod, currentHash);\n }\n else\n {\n var xMembers = x.GetValidAnonymousTypeProperties();\n\n return xMembers.Aggregate(currentHash, (a, p) =>\n {\n return Hash.Combine(p.Name,\n Hash.Combine(p.IsReadOnly,\n GetHashCode(p.Type, a)));\n });\n }\n }\n\n private int CombineHashCodes(INamespaceSymbol x, int currentHash)\n {\n if (x.IsGlobalNamespace && _symbolEquivalenceComparer._assemblyComparerOpt == null)\n {\n // Exclude global namespace's container's hash when assemblies can differ.\n return Hash.Combine(x.Name, currentHash);\n }\n\n return\n Hash.Combine(x.IsGlobalNamespace,\n Hash.Combine(x.Name,\n GetHashCode(x.ContainingSymbol, currentHash)));\n }\n\n private int CombineHashCodes(IParameterSymbol x, int currentHash)\n {\n return\n Hash.Combine(x.IsRefOrOut(),\n Hash.Combine(x.Name,\n GetHashCode(x.Type,\n GetHashCode(x.ContainingSymbol, currentHash))));\n }\n\n private int CombineHashCodes(IPointerTypeSymbol x, int currentHash)\n {\n return\n Hash.Combine(typeof(IPointerTypeSymbol).GetHashCode(),\n GetHashCode(x.PointedAtType, currentHash));\n }\n\n private int CombineHashCodes(IPropertySymbol x, int currentHash)\n {\n currentHash =\n Hash.Combine(x.IsIndexer,\n Hash.Combine(x.Name,\n Hash.Combine(x.Parameters.Length,\n GetHashCode(x.ContainingSymbol, currentHash))));\n\n return CombineHashCodes(x.Parameters, currentHash, _parameterAggregator);\n }\n\n private int CombineHashCodes(IEventSymbol x, int currentHash)\n {\n return\n Hash.Combine(x.Name,\n GetHashCode(x.ContainingSymbol, currentHash));\n }\n\n public int CombineHashCodes(ITypeParameterSymbol x, int currentHash)\n {\n Debug.Assert(\n (x.TypeParameterKind == TypeParameterKind.Method && IsConstructedFromSelf(x.DeclaringMethod!)) ||\n (x.TypeParameterKind == TypeParameterKind.Type && IsConstructedFromSelf(x.ContainingType)) ||\n x.TypeParameterKind == TypeParameterKind.Cref);\n\n currentHash =\n Hash.Combine(x.Ordinal,\n Hash.Combine((int)x.TypeParameterKind, currentHash));\n\n if (x.TypeParameterKind == TypeParameterKind.Method && _compareMethodTypeParametersByIndex)\n {\n return currentHash;\n }\n\n if (x.TypeParameterKind == TypeParameterKind.Type && x.ContainingType.IsAnonymousType)\n {\n // Anonymous type type parameters compare by index as well to prevent\n // recursion.\n return currentHash;\n }\n\n if (x.TypeParameterKind == TypeParameterKind.Cref)\n {\n return currentHash;\n }\n\n return\n GetHashCode(x.ContainingSymbol, currentHash);\n }\n\n private static int CombineHashCodes(IRangeVariableSymbol x, int currentHash)\n => Hash.Combine(x.Locations.FirstOrDefault(), currentHash);\n\n private static int CombineHashCodes(IPreprocessingSymbol x, int currentHash)\n => Hash.Combine(x.GetHashCode(), currentHash);\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Linq;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.Shared.Utilities\n{\n internal partial class SymbolEquivalenceComparer\n {\n private class GetHashCodeVisitor\n {\n private readonly SymbolEquivalenceComparer _symbolEquivalenceComparer;\n private readonly bool _compareMethodTypeParametersByIndex;\n private readonly bool _objectAndDynamicCompareEqually;\n private readonly Func _parameterAggregator;\n private readonly Func _symbolAggregator;\n\n public GetHashCodeVisitor(\n SymbolEquivalenceComparer symbolEquivalenceComparer,\n bool compareMethodTypeParametersByIndex,\n bool objectAndDynamicCompareEqually)\n {\n _symbolEquivalenceComparer = symbolEquivalenceComparer;\n _compareMethodTypeParametersByIndex = compareMethodTypeParametersByIndex;\n _objectAndDynamicCompareEqually = objectAndDynamicCompareEqually;\n _parameterAggregator = (acc, sym) => Hash.Combine(symbolEquivalenceComparer.ParameterEquivalenceComparer.GetHashCode(sym), acc);\n _symbolAggregator = (acc, sym) => GetHashCode(sym, acc);\n }\n\n public int GetHashCode(ISymbol? x, int currentHash)\n {\n if (x == null)\n return 0;\n\n x = UnwrapAlias(x);\n\n // Special case. If we're comparing signatures then we want to compare 'object'\n // and 'dynamic' as the same. However, since they're different types, we don't\n // want to bail out using the above check.\n\n if (x.Kind == SymbolKind.DynamicType ||\n (_objectAndDynamicCompareEqually && IsObjectType(x)))\n {\n return Hash.Combine(GetNullableAnnotationsHashCode((ITypeSymbol)x), Hash.Combine(typeof(IDynamicTypeSymbol), currentHash));\n }\n\n return GetHashCodeWorker(x, currentHash);\n }\n\n private int GetNullableAnnotationsHashCode(ITypeSymbol type)\n => _symbolEquivalenceComparer._ignoreNullableAnnotations ? 0 : type.NullableAnnotation.GetHashCode();\n\n private int GetHashCodeWorker(ISymbol x, int currentHash)\n => x.Kind switch\n {\n SymbolKind.ArrayType => CombineHashCodes((IArrayTypeSymbol)x, currentHash),\n SymbolKind.Assembly => CombineHashCodes((IAssemblySymbol)x, currentHash),\n SymbolKind.Event => CombineHashCodes((IEventSymbol)x, currentHash),\n SymbolKind.Field => CombineHashCodes((IFieldSymbol)x, currentHash),\n SymbolKind.Label => CombineHashCodes((ILabelSymbol)x, currentHash),\n SymbolKind.Local => CombineHashCodes((ILocalSymbol)x, currentHash),\n SymbolKind.Method => CombineHashCodes((IMethodSymbol)x, currentHash),\n SymbolKind.NetModule => CombineHashCodes((IModuleSymbol)x, currentHash),\n SymbolKind.NamedType => CombineHashCodes((INamedTypeSymbol)x, currentHash),\n SymbolKind.Namespace => CombineHashCodes((INamespaceSymbol)x, currentHash),\n SymbolKind.Parameter => CombineHashCodes((IParameterSymbol)x, currentHash),\n SymbolKind.PointerType => CombineHashCodes((IPointerTypeSymbol)x, currentHash),\n SymbolKind.Property => CombineHashCodes((IPropertySymbol)x, currentHash),\n SymbolKind.RangeVariable => CombineHashCodes((IRangeVariableSymbol)x, currentHash),\n SymbolKind.TypeParameter => CombineHashCodes((ITypeParameterSymbol)x, currentHash),\n SymbolKind.Preprocessing => CombineHashCodes((IPreprocessingSymbol)x, currentHash),\n _ => -1,\n };\n\n private int CombineHashCodes(IArrayTypeSymbol x, int currentHash)\n {\n return\n Hash.Combine(GetNullableAnnotationsHashCode(x),\n Hash.Combine(x.Rank,\n GetHashCode(x.ElementType, currentHash)));\n }\n\n private int CombineHashCodes(IAssemblySymbol x, int currentHash)\n => Hash.Combine(_symbolEquivalenceComparer._assemblyComparerOpt?.GetHashCode(x) ?? 0, currentHash);\n\n private int CombineHashCodes(IFieldSymbol x, int currentHash)\n {\n return\n Hash.Combine(x.Name,\n GetHashCode(x.ContainingSymbol, currentHash));\n }\n\n private static int CombineHashCodes(ILabelSymbol x, int currentHash)\n {\n return\n Hash.Combine(x.Name,\n Hash.Combine(x.Locations.FirstOrDefault(), currentHash));\n }\n\n private static int CombineHashCodes(ILocalSymbol x, int currentHash)\n => Hash.Combine(x.Locations.FirstOrDefault(), currentHash);\n\n private static int CombineHashCodes(ImmutableArray array, int currentHash, Func func)\n => array.Aggregate(currentHash, func);\n\n private int CombineHashCodes(IMethodSymbol x, int currentHash)\n {\n currentHash = Hash.Combine(x.MetadataName, currentHash);\n if (x.MethodKind == MethodKind.AnonymousFunction)\n {\n return Hash.Combine(x.Locations.FirstOrDefault(), currentHash);\n }\n\n currentHash =\n Hash.Combine(IsPartialMethodImplementationPart(x),\n Hash.Combine(IsPartialMethodDefinitionPart(x),\n Hash.Combine(x.IsDefinition,\n Hash.Combine(IsConstructedFromSelf(x),\n Hash.Combine(x.Arity,\n Hash.Combine(x.Parameters.Length,\n Hash.Combine(x.Name, currentHash)))))));\n\n var checkContainingType = CheckContainingType(x);\n if (checkContainingType)\n {\n currentHash = GetHashCode(x.ContainingSymbol, currentHash);\n }\n\n currentHash =\n CombineHashCodes(x.Parameters, currentHash, _parameterAggregator);\n\n return IsConstructedFromSelf(x)\n ? currentHash\n : CombineHashCodes(x.TypeArguments, currentHash, _symbolAggregator);\n }\n\n private int CombineHashCodes(IModuleSymbol x, int currentHash)\n => CombineHashCodes(x.ContainingAssembly, Hash.Combine(x.Name, currentHash));\n\n private int CombineHashCodes(INamedTypeSymbol x, int currentHash)\n {\n currentHash = CombineNamedTypeHashCode(x, currentHash);\n\n if (x is IErrorTypeSymbol errorType)\n {\n foreach (var candidate in errorType.CandidateSymbols)\n {\n if (candidate is INamedTypeSymbol candidateNamedType)\n {\n currentHash = CombineNamedTypeHashCode(candidateNamedType, currentHash);\n }\n }\n }\n\n return currentHash;\n }\n\n private int CombineNamedTypeHashCode(INamedTypeSymbol x, int currentHash)\n {\n if (x.IsTupleType)\n {\n return Hash.Combine(currentHash, Hash.CombineValues(x.TupleElements));\n }\n\n // If we want object and dynamic to be the same, and this is 'object', then return\n // the same hash we do for 'dynamic'.\n currentHash =\n Hash.Combine((int)GetTypeKind(x),\n Hash.Combine(IsConstructedFromSelf(x),\n Hash.Combine(x.Arity,\n Hash.Combine(x.Name,\n Hash.Combine(x.IsAnonymousType,\n Hash.Combine(x.IsUnboundGenericType,\n Hash.Combine(GetNullableAnnotationsHashCode(x),\n GetHashCode(x.ContainingSymbol, currentHash))))))));\n\n if (x.IsAnonymousType)\n {\n return CombineAnonymousTypeHashCode(x, currentHash);\n }\n\n return IsConstructedFromSelf(x) || x.IsUnboundGenericType\n ? currentHash\n : CombineHashCodes(x.TypeArguments, currentHash, _symbolAggregator);\n }\n\n private int CombineAnonymousTypeHashCode(INamedTypeSymbol x, int currentHash)\n {\n if (x.TypeKind == TypeKind.Delegate)\n {\n return GetHashCode(x.DelegateInvokeMethod, currentHash);\n }\n else\n {\n var xMembers = x.GetValidAnonymousTypeProperties();\n\n return xMembers.Aggregate(currentHash, (a, p) =>\n {\n return Hash.Combine(p.Name,\n Hash.Combine(p.IsReadOnly,\n GetHashCode(p.Type, a)));\n });\n }\n }\n\n private int CombineHashCodes(INamespaceSymbol x, int currentHash)\n {\n if (x.IsGlobalNamespace && _symbolEquivalenceComparer._assemblyComparerOpt == null)\n {\n // Exclude global namespace's container's hash when assemblies can differ.\n return Hash.Combine(x.Name, currentHash);\n }\n\n return\n Hash.Combine(x.IsGlobalNamespace,\n Hash.Combine(x.Name,\n GetHashCode(x.ContainingSymbol, currentHash)));\n }\n\n private int CombineHashCodes(IParameterSymbol x, int currentHash)\n {\n return\n Hash.Combine(x.IsRefOrOut(),\n Hash.Combine(x.Name,\n GetHashCode(x.Type,\n GetHashCode(x.ContainingSymbol, currentHash))));\n }\n\n private int CombineHashCodes(IPointerTypeSymbol x, int currentHash)\n {\n return\n Hash.Combine(typeof(IPointerTypeSymbol).GetHashCode(),\n GetHashCode(x.PointedAtType, currentHash));\n }\n\n private int CombineHashCodes(IPropertySymbol x, int currentHash)\n {\n currentHash =\n Hash.Combine(x.IsIndexer,\n Hash.Combine(x.Name,\n Hash.Combine(x.Parameters.Length,\n GetHashCode(x.ContainingSymbol, currentHash))));\n\n return CombineHashCodes(x.Parameters, currentHash, _parameterAggregator);\n }\n\n private int CombineHashCodes(IEventSymbol x, int currentHash)\n {\n return\n Hash.Combine(x.Name,\n GetHashCode(x.ContainingSymbol, currentHash));\n }\n\n public int CombineHashCodes(ITypeParameterSymbol x, int currentHash)\n {\n Debug.Assert(\n (x.TypeParameterKind == TypeParameterKind.Method && IsConstructedFromSelf(x.DeclaringMethod!)) ||\n (x.TypeParameterKind == TypeParameterKind.Type && IsConstructedFromSelf(x.ContainingType)) ||\n x.TypeParameterKind == TypeParameterKind.Cref);\n\n currentHash =\n Hash.Combine(x.Ordinal,\n Hash.Combine((int)x.TypeParameterKind, currentHash));\n\n if (x.TypeParameterKind == TypeParameterKind.Method && _compareMethodTypeParametersByIndex)\n {\n return currentHash;\n }\n\n if (x.TypeParameterKind == TypeParameterKind.Type && x.ContainingType.IsAnonymousType)\n {\n // Anonymous type type parameters compare by index as well to prevent\n // recursion.\n return currentHash;\n }\n\n if (x.TypeParameterKind == TypeParameterKind.Cref)\n {\n return currentHash;\n }\n\n return\n GetHashCode(x.ContainingSymbol, currentHash);\n }\n\n private static int CombineHashCodes(IRangeVariableSymbol x, int currentHash)\n => Hash.Combine(x.Locations.FirstOrDefault(), currentHash);\n\n private static int CombineHashCodes(IPreprocessingSymbol x, int currentHash)\n => Hash.Combine(x.GetHashCode(), currentHash);\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":422,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Compilers/Core/Portable/InternalUtilities/CommandLineUtilities.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Roslyn.Utilities\n{\n internal static class CommandLineUtilities\n {\n /// \n /// Split a command line by the same rules as Main would get the commands except the original\n /// state of backslashes and quotes are preserved. For example in normal Windows command line \n /// parsing the following command lines would produce equivalent Main arguments:\n /// \n /// - /r:a,b\n /// - /r:\"a,b\"\n /// \n /// This method will differ as the latter will have the quotes preserved. The only case where \n /// quotes are removed is when the entire argument is surrounded by quotes without any inner\n /// quotes. \n /// \n /// \n /// Rules for command line parsing, according to MSDN:\n /// \n /// Arguments are delimited by white space, which is either a space or a tab.\n /// \n /// A string surrounded by double quotation marks (\"string\") is interpreted \n /// as a single argument, regardless of white space contained within. \n /// A quoted string can be embedded in an argument.\n /// \n /// A double quotation mark preceded by a backslash (\\\") is interpreted as a \n /// literal double quotation mark character (\").\n /// \n /// Backslashes are interpreted literally, unless they immediately precede a \n /// double quotation mark.\n /// \n /// If an even number of backslashes is followed by a double quotation mark, \n /// one backslash is placed in the argv array for every pair of backslashes, \n /// and the double quotation mark is interpreted as a string delimiter.\n /// \n /// If an odd number of backslashes is followed by a double quotation mark, \n /// one backslash is placed in the argv array for every pair of backslashes, \n /// and the double quotation mark is \"escaped\" by the remaining backslash, \n /// causing a literal double quotation mark (\") to be placed in argv.\n /// \n public static List SplitCommandLineIntoArguments(string commandLine, bool removeHashComments)\n {\n return SplitCommandLineIntoArguments(commandLine, removeHashComments, out _);\n }\n\n public static List SplitCommandLineIntoArguments(string commandLine, bool removeHashComments, out char? illegalChar)\n {\n var list = new List();\n SplitCommandLineIntoArguments(commandLine.AsSpan(), removeHashComments, new StringBuilder(), list, out illegalChar);\n return list;\n }\n\n public static void SplitCommandLineIntoArguments(ReadOnlySpan commandLine, bool removeHashComments, StringBuilder builder, List list, out char? illegalChar)\n {\n var i = 0;\n\n builder.Length = 0;\n illegalChar = null;\n while (i < commandLine.Length)\n {\n while (i < commandLine.Length && char.IsWhiteSpace(commandLine[i]))\n {\n i++;\n }\n\n if (i == commandLine.Length)\n {\n break;\n }\n\n if (commandLine[i] == '#' && removeHashComments)\n {\n break;\n }\n\n var quoteCount = 0;\n builder.Length = 0;\n while (i < commandLine.Length && (!char.IsWhiteSpace(commandLine[i]) || (quoteCount % 2 != 0)))\n {\n var current = commandLine[i];\n switch (current)\n {\n case '\\\\':\n {\n var slashCount = 0;\n do\n {\n builder.Append(commandLine[i]);\n i++;\n slashCount++;\n } while (i < commandLine.Length && commandLine[i] == '\\\\');\n\n // Slashes not followed by a quote character can be ignored for now\n if (i >= commandLine.Length || commandLine[i] != '\"')\n {\n break;\n }\n\n // If there is an odd number of slashes then it is escaping the quote\n // otherwise it is just a quote.\n if (slashCount % 2 == 0)\n {\n quoteCount++;\n }\n\n builder.Append('\"');\n i++;\n break;\n }\n\n case '\"':\n builder.Append(current);\n quoteCount++;\n i++;\n break;\n\n default:\n if ((current >= 0x1 && current <= 0x1f) || current == '|')\n {\n if (illegalChar == null)\n {\n illegalChar = current;\n }\n }\n else\n {\n builder.Append(current);\n }\n\n i++;\n break;\n }\n }\n\n // If the quote string is surrounded by quotes with no interior quotes then \n // remove the quotes here. \n if (quoteCount == 2 && builder[0] == '\"' && builder[builder.Length - 1] == '\"')\n {\n builder.Remove(0, length: 1);\n builder.Remove(builder.Length - 1, length: 1);\n }\n\n if (builder.Length > 0)\n {\n list.Add(builder.ToString());\n }\n }\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Roslyn.Utilities\n{\n internal static class CommandLineUtilities\n {\n /// \n /// Split a command line by the same rules as Main would get the commands except the original\n /// state of backslashes and quotes are preserved. For example in normal Windows command line \n /// parsing the following command lines would produce equivalent Main arguments:\n /// \n /// - /r:a,b\n /// - /r:\"a,b\"\n /// \n /// This method will differ as the latter will have the quotes preserved. The only case where \n /// quotes are removed is when the entire argument is surrounded by quotes without any inner\n /// quotes. \n /// \n /// \n /// Rules for command line parsing, according to MSDN:\n /// \n /// Arguments are delimited by white space, which is either a space or a tab.\n /// \n /// A string surrounded by double quotation marks (\"string\") is interpreted \n /// as a single argument, regardless of white space contained within. \n /// A quoted string can be embedded in an argument.\n /// \n /// A double quotation mark preceded by a backslash (\\\") is interpreted as a \n /// literal double quotation mark character (\").\n /// \n /// Backslashes are interpreted literally, unless they immediately precede a \n /// double quotation mark.\n /// \n /// If an even number of backslashes is followed by a double quotation mark, \n /// one backslash is placed in the argv array for every pair of backslashes, \n /// and the double quotation mark is interpreted as a string delimiter.\n /// \n /// If an odd number of backslashes is followed by a double quotation mark, \n /// one backslash is placed in the argv array for every pair of backslashes, \n /// and the double quotation mark is \"escaped\" by the remaining backslash, \n /// causing a literal double quotation mark (\") to be placed in argv.\n /// \n public static List SplitCommandLineIntoArguments(string commandLine, bool removeHashComments)\n {\n return SplitCommandLineIntoArguments(commandLine, removeHashComments, out _);\n }\n\n public static List SplitCommandLineIntoArguments(string commandLine, bool removeHashComments, out char? illegalChar)\n {\n var list = new List();\n SplitCommandLineIntoArguments(commandLine.AsSpan(), removeHashComments, new StringBuilder(), list, out illegalChar);\n return list;\n }\n\n public static void SplitCommandLineIntoArguments(ReadOnlySpan commandLine, bool removeHashComments, StringBuilder builder, List list, out char? illegalChar)\n {\n var i = 0;\n\n builder.Length = 0;\n illegalChar = null;\n while (i < commandLine.Length)\n {\n while (i < commandLine.Length && char.IsWhiteSpace(commandLine[i]))\n {\n i++;\n }\n\n if (i == commandLine.Length)\n {\n break;\n }\n\n if (commandLine[i] == '#' && removeHashComments)\n {\n break;\n }\n\n var quoteCount = 0;\n builder.Length = 0;\n while (i < commandLine.Length && (!char.IsWhiteSpace(commandLine[i]) || (quoteCount % 2 != 0)))\n {\n var current = commandLine[i];\n switch (current)\n {\n case '\\\\':\n {\n var slashCount = 0;\n do\n {\n builder.Append(commandLine[i]);\n i++;\n slashCount++;\n } while (i < commandLine.Length && commandLine[i] == '\\\\');\n\n // Slashes not followed by a quote character can be ignored for now\n if (i >= commandLine.Length || commandLine[i] != '\"')\n {\n break;\n }\n\n // If there is an odd number of slashes then it is escaping the quote\n // otherwise it is just a quote.\n if (slashCount % 2 == 0)\n {\n quoteCount++;\n }\n\n builder.Append('\"');\n i++;\n break;\n }\n\n case '\"':\n builder.Append(current);\n quoteCount++;\n i++;\n break;\n\n default:\n if ((current >= 0x1 && current <= 0x1f) || current == '|')\n {\n if (illegalChar == null)\n {\n illegalChar = current;\n }\n }\n else\n {\n builder.Append(current);\n }\n\n i++;\n break;\n }\n }\n\n // If the quote string is surrounded by quotes with no interior quotes then \n // remove the quotes here. \n if (quoteCount == 2 && builder[0] == '\"' && builder[builder.Length - 1] == '\"')\n {\n builder.Remove(0, length: 1);\n builder.Remove(builder.Length - 1, length: 1);\n }\n\n if (builder.Length > 0)\n {\n list.Add(builder.ToString());\n }\n }\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":423,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmEvaluationAsyncResult.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\n#region Assembly Microsoft.VisualStudio.Debugger.Engine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\n// D:\\Roslyn\\Main\\Open\\Binaries\\Debug\\Microsoft.VisualStudio.Debugger.Engine.dll\n#endregion\n\nusing System;\n\nnamespace Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation\n{\n public struct DkmEvaluationAsyncResult\n {\n private readonly DkmEvaluationResult _result;\n\n public DkmEvaluationAsyncResult(DkmEvaluationResult Result)\n : this()\n {\n if (Result == null)\n {\n throw new ArgumentNullException(nameof(Result));\n }\n\n _result = Result;\n }\n\n public int ErrorCode { get { throw new NotImplementedException(); } }\n\n public DkmEvaluationResult Result { get { return _result; } }\n\n internal Exception Exception { get; set; }\n\n public static DkmEvaluationAsyncResult CreateErrorResult(Exception exception)\n {\n return new DkmEvaluationAsyncResult() { Exception = exception };\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\n#region Assembly Microsoft.VisualStudio.Debugger.Engine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\n// D:\\Roslyn\\Main\\Open\\Binaries\\Debug\\Microsoft.VisualStudio.Debugger.Engine.dll\n#endregion\n\nusing System;\n\nnamespace Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation\n{\n public struct DkmEvaluationAsyncResult\n {\n private readonly DkmEvaluationResult _result;\n\n public DkmEvaluationAsyncResult(DkmEvaluationResult Result)\n : this()\n {\n if (Result == null)\n {\n throw new ArgumentNullException(nameof(Result));\n }\n\n _result = Result;\n }\n\n public int ErrorCode { get { throw new NotImplementedException(); } }\n\n public DkmEvaluationResult Result { get { return _result; } }\n\n internal Exception Exception { get; set; }\n\n public static DkmEvaluationAsyncResult CreateErrorResult(Exception exception)\n {\n return new DkmEvaluationAsyncResult() { Exception = exception };\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":424,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInlineRenameReplacementKindHelpers.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing Microsoft.CodeAnalysis.Editor;\nusing Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript\n{\n internal static class VSTypeScriptInlineRenameReplacementKindHelpers\n {\n public static VSTypeScriptInlineRenameReplacementKind ConvertFrom(InlineRenameReplacementKind kind)\n {\n return kind switch\n {\n InlineRenameReplacementKind.NoConflict => VSTypeScriptInlineRenameReplacementKind.NoConflict,\n InlineRenameReplacementKind.ResolvedReferenceConflict => VSTypeScriptInlineRenameReplacementKind.ResolvedReferenceConflict,\n InlineRenameReplacementKind.ResolvedNonReferenceConflict => VSTypeScriptInlineRenameReplacementKind.ResolvedNonReferenceConflict,\n InlineRenameReplacementKind.UnresolvedConflict => VSTypeScriptInlineRenameReplacementKind.UnresolvedConflict,\n InlineRenameReplacementKind.Complexified => VSTypeScriptInlineRenameReplacementKind.Complexified,\n _ => throw ExceptionUtilities.UnexpectedValue(kind),\n };\n }\n\n public static InlineRenameReplacementKind ConvertTo(VSTypeScriptInlineRenameReplacementKind kind)\n {\n return kind switch\n {\n VSTypeScriptInlineRenameReplacementKind.NoConflict => InlineRenameReplacementKind.NoConflict,\n VSTypeScriptInlineRenameReplacementKind.ResolvedReferenceConflict => InlineRenameReplacementKind.ResolvedReferenceConflict,\n VSTypeScriptInlineRenameReplacementKind.ResolvedNonReferenceConflict => InlineRenameReplacementKind.ResolvedNonReferenceConflict,\n VSTypeScriptInlineRenameReplacementKind.UnresolvedConflict => InlineRenameReplacementKind.UnresolvedConflict,\n VSTypeScriptInlineRenameReplacementKind.Complexified => InlineRenameReplacementKind.Complexified,\n _ => throw ExceptionUtilities.UnexpectedValue(kind),\n };\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing Microsoft.CodeAnalysis.Editor;\nusing Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript\n{\n internal static class VSTypeScriptInlineRenameReplacementKindHelpers\n {\n public static VSTypeScriptInlineRenameReplacementKind ConvertFrom(InlineRenameReplacementKind kind)\n {\n return kind switch\n {\n InlineRenameReplacementKind.NoConflict => VSTypeScriptInlineRenameReplacementKind.NoConflict,\n InlineRenameReplacementKind.ResolvedReferenceConflict => VSTypeScriptInlineRenameReplacementKind.ResolvedReferenceConflict,\n InlineRenameReplacementKind.ResolvedNonReferenceConflict => VSTypeScriptInlineRenameReplacementKind.ResolvedNonReferenceConflict,\n InlineRenameReplacementKind.UnresolvedConflict => VSTypeScriptInlineRenameReplacementKind.UnresolvedConflict,\n InlineRenameReplacementKind.Complexified => VSTypeScriptInlineRenameReplacementKind.Complexified,\n _ => throw ExceptionUtilities.UnexpectedValue(kind),\n };\n }\n\n public static InlineRenameReplacementKind ConvertTo(VSTypeScriptInlineRenameReplacementKind kind)\n {\n return kind switch\n {\n VSTypeScriptInlineRenameReplacementKind.NoConflict => InlineRenameReplacementKind.NoConflict,\n VSTypeScriptInlineRenameReplacementKind.ResolvedReferenceConflict => InlineRenameReplacementKind.ResolvedReferenceConflict,\n VSTypeScriptInlineRenameReplacementKind.ResolvedNonReferenceConflict => InlineRenameReplacementKind.ResolvedNonReferenceConflict,\n VSTypeScriptInlineRenameReplacementKind.UnresolvedConflict => InlineRenameReplacementKind.UnresolvedConflict,\n VSTypeScriptInlineRenameReplacementKind.Complexified => InlineRenameReplacementKind.Complexified,\n _ => throw ExceptionUtilities.UnexpectedValue(kind),\n };\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":425,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Portable/Symbols/Source/SourceClonedParameterSymbol.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Symbols\n{\n /// \n /// Represents a source parameter cloned from another , when they must share attribute data and default constant value.\n /// For example, parameters on a property symbol are cloned to generate parameters on accessors.\n /// Similarly parameters on delegate invoke method are cloned to delegate begin/end invoke methods.\n /// \n internal abstract class SourceClonedParameterSymbol : SourceParameterSymbolBase\n {\n // if true suppresses params-array and default value:\n private readonly bool _suppressOptional;\n\n protected readonly SourceParameterSymbol _originalParam;\n\n internal SourceClonedParameterSymbol(SourceParameterSymbol originalParam, Symbol newOwner, int newOrdinal, bool suppressOptional)\n : base(newOwner, newOrdinal)\n {\n Debug.Assert((object)originalParam != null);\n _suppressOptional = suppressOptional;\n _originalParam = originalParam;\n }\n\n public override bool IsImplicitlyDeclared => true;\n\n public override bool IsDiscard => _originalParam.IsDiscard;\n\n public override ImmutableArray DeclaringSyntaxReferences\n {\n get\n {\n // Since you can't get from the syntax node that represents the original parameter \n // back to this symbol we decided not to return the original syntax node here.\n return ImmutableArray.Empty;\n }\n }\n\n public override bool IsParams\n {\n get { return !_suppressOptional && _originalParam.IsParams; }\n }\n\n internal override bool IsMetadataOptional\n {\n get\n {\n // pseudo-custom attributes are not suppressed:\n return _suppressOptional ? _originalParam.HasOptionalAttribute : _originalParam.IsMetadataOptional;\n }\n }\n\n internal override ConstantValue ExplicitDefaultConstantValue\n {\n get\n {\n // pseudo-custom attributes are not suppressed:\n return _suppressOptional ? _originalParam.DefaultValueFromAttributes : _originalParam.ExplicitDefaultConstantValue;\n }\n }\n\n internal override ConstantValue DefaultValueFromAttributes\n {\n get { return _originalParam.DefaultValueFromAttributes; }\n }\n\n #region Forwarded\n\n public override TypeWithAnnotations TypeWithAnnotations\n {\n get { return _originalParam.TypeWithAnnotations; }\n }\n\n public override RefKind RefKind\n {\n get { return _originalParam.RefKind; }\n }\n\n internal override bool IsMetadataIn\n {\n get { return _originalParam.IsMetadataIn; }\n }\n\n internal override bool IsMetadataOut\n {\n get { return _originalParam.IsMetadataOut; }\n }\n\n public override ImmutableArray Locations\n {\n get { return _originalParam.Locations; }\n }\n\n public override ImmutableArray GetAttributes()\n {\n return _originalParam.GetAttributes();\n }\n\n public sealed override string Name\n {\n get { return _originalParam.Name; }\n }\n\n public override ImmutableArray RefCustomModifiers\n {\n get { return _originalParam.RefCustomModifiers; }\n }\n\n internal override MarshalPseudoCustomAttributeData MarshallingInformation\n {\n get { return _originalParam.MarshallingInformation; }\n }\n\n internal override bool IsIDispatchConstant\n {\n get { return _originalParam.IsIDispatchConstant; }\n }\n\n internal override bool IsIUnknownConstant\n {\n get { return _originalParam.IsIUnknownConstant; }\n }\n\n internal override FlowAnalysisAnnotations FlowAnalysisAnnotations\n {\n get { return FlowAnalysisAnnotations.None; }\n }\n\n internal override ImmutableHashSet NotNullIfParameterNotNull\n {\n get { return ImmutableHashSet.Empty; }\n }\n\n internal override ImmutableArray InterpolatedStringHandlerArgumentIndexes => throw ExceptionUtilities.Unreachable;\n\n internal override bool HasInterpolatedStringHandlerArgumentError => throw ExceptionUtilities.Unreachable;\n\n #endregion\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Symbols\n{\n /// \n /// Represents a source parameter cloned from another , when they must share attribute data and default constant value.\n /// For example, parameters on a property symbol are cloned to generate parameters on accessors.\n /// Similarly parameters on delegate invoke method are cloned to delegate begin/end invoke methods.\n /// \n internal abstract class SourceClonedParameterSymbol : SourceParameterSymbolBase\n {\n // if true suppresses params-array and default value:\n private readonly bool _suppressOptional;\n\n protected readonly SourceParameterSymbol _originalParam;\n\n internal SourceClonedParameterSymbol(SourceParameterSymbol originalParam, Symbol newOwner, int newOrdinal, bool suppressOptional)\n : base(newOwner, newOrdinal)\n {\n Debug.Assert((object)originalParam != null);\n _suppressOptional = suppressOptional;\n _originalParam = originalParam;\n }\n\n public override bool IsImplicitlyDeclared => true;\n\n public override bool IsDiscard => _originalParam.IsDiscard;\n\n public override ImmutableArray DeclaringSyntaxReferences\n {\n get\n {\n // Since you can't get from the syntax node that represents the original parameter \n // back to this symbol we decided not to return the original syntax node here.\n return ImmutableArray.Empty;\n }\n }\n\n public override bool IsParams\n {\n get { return !_suppressOptional && _originalParam.IsParams; }\n }\n\n internal override bool IsMetadataOptional\n {\n get\n {\n // pseudo-custom attributes are not suppressed:\n return _suppressOptional ? _originalParam.HasOptionalAttribute : _originalParam.IsMetadataOptional;\n }\n }\n\n internal override ConstantValue ExplicitDefaultConstantValue\n {\n get\n {\n // pseudo-custom attributes are not suppressed:\n return _suppressOptional ? _originalParam.DefaultValueFromAttributes : _originalParam.ExplicitDefaultConstantValue;\n }\n }\n\n internal override ConstantValue DefaultValueFromAttributes\n {\n get { return _originalParam.DefaultValueFromAttributes; }\n }\n\n #region Forwarded\n\n public override TypeWithAnnotations TypeWithAnnotations\n {\n get { return _originalParam.TypeWithAnnotations; }\n }\n\n public override RefKind RefKind\n {\n get { return _originalParam.RefKind; }\n }\n\n internal override bool IsMetadataIn\n {\n get { return _originalParam.IsMetadataIn; }\n }\n\n internal override bool IsMetadataOut\n {\n get { return _originalParam.IsMetadataOut; }\n }\n\n public override ImmutableArray Locations\n {\n get { return _originalParam.Locations; }\n }\n\n public override ImmutableArray GetAttributes()\n {\n return _originalParam.GetAttributes();\n }\n\n public sealed override string Name\n {\n get { return _originalParam.Name; }\n }\n\n public override ImmutableArray RefCustomModifiers\n {\n get { return _originalParam.RefCustomModifiers; }\n }\n\n internal override MarshalPseudoCustomAttributeData MarshallingInformation\n {\n get { return _originalParam.MarshallingInformation; }\n }\n\n internal override bool IsIDispatchConstant\n {\n get { return _originalParam.IsIDispatchConstant; }\n }\n\n internal override bool IsIUnknownConstant\n {\n get { return _originalParam.IsIUnknownConstant; }\n }\n\n internal override FlowAnalysisAnnotations FlowAnalysisAnnotations\n {\n get { return FlowAnalysisAnnotations.None; }\n }\n\n internal override ImmutableHashSet NotNullIfParameterNotNull\n {\n get { return ImmutableHashSet.Empty; }\n }\n\n internal override ImmutableArray InterpolatedStringHandlerArgumentIndexes => throw ExceptionUtilities.Unreachable;\n\n internal override bool HasInterpolatedStringHandlerArgumentError => throw ExceptionUtilities.Unreachable;\n\n #endregion\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":426,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56473,"string":"56,473"},"pr_title":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function"},"pr_description":{"kind":"string","value":"Fixes https://github.com/dotnet/roslyn/issues/53179"},"author":{"kind":"string","value":"jcouv"},"date_created":{"kind":"timestamp","value":"2021-09-17T03:29:26Z","string":"2021-09-17T03:29:26Z"},"date_merged":{"kind":"timestamp","value":"2021-09-17T21:32:30Z","string":"2021-09-17T21:32:30Z"},"previous_commit":{"kind":"string","value":"e3756cc7c7229e1509f27ab3de712c59f634c554"},"pr_commit":{"kind":"string","value":"a73ef13d7f21ca65c1fc85fa6c6cbde0d075c45d"},"query":{"kind":"string","value":"Fix MakeLocalFunctionStatic for top-level local function. Fixes https://github.com/dotnet/roslyn/issues/53179"},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.CSharp.Test.Utilities;\nusing Microsoft.CodeAnalysis.Test.Utilities;\nusing Roslyn.Test.Utilities;\nusing Xunit;\nusing static Roslyn.Test.Utilities.TestMetadata;\n\nnamespace Microsoft.CodeAnalysis.CSharp.UnitTests\n{\n /// \n /// this place is dedicated to binding related error tests\n /// \n public class SemanticErrorTests : CompilingTestBase\n {\n #region \"Targeted Error Tests - please arrange tests in the order of error code\"\n\n [Fact]\n public void CS0019ERR_BadBinaryOps01()\n {\n var text = @\"\nnamespace x\n{\n public class b\n {\n public static void Main()\n {\n bool q = false;\n if (q == 1)\n { }\n }\n }\n}\n\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text,\n new ErrorDescription { Code = (int)ErrorCode.ERR_BadBinaryOps, Line = 9, Column = 17 });\n }\n\n [Fact]\n public void CS0019ERR_BadBinaryOps02()\n {\n var text =\n@\"using System;\nenum E { A, B, C }\nenum F { X = (E.A + E.B) * DayOfWeek.Monday } // no error\nclass C\n{\n static void M(object o)\n {\n M((E.A + E.B) * DayOfWeek.Monday);\n }\n}\n\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text,\n new ErrorDescription { Code = (int)ErrorCode.ERR_BadBinaryOps, Line = 8, Column = 12 });\n }\n\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps03()\n {\n var text =\n@\"delegate void MyDelegate1(ref int x, out float y);\nclass Program\n{\n public void DelegatedMethod1(ref int x, out float y)\n {\n y = 1;\n }\n public void DelegatedMethod2(out int x, ref float y)\n {\n x = 1;\n }\n public void DelegatedMethod3(out int x, float y = 1)\n {\n x = 1;\n }\n static void Main(string[] args)\n {\n Program mc = new Program();\n MyDelegate1 md1 = null;\n md1 += mc.DelegatedMethod1;\n md1 += mc.DelegatedMethod2; // Invalid\n md1 += mc.DelegatedMethod3; // Invalid\n md1 -= mc.DelegatedMethod1;\n md1 -= mc.DelegatedMethod2; // Invalid\n md1 -= mc.DelegatedMethod3; // Invalid\n }\n}\n\";\n CreateCompilation(text).\n VerifyDiagnostics(\n // (21,19): error CS0123: No overload for 'DelegatedMethod2' matches delegate 'MyDelegate1'\n // md1 += mc.DelegatedMethod2; // Invalid\n Diagnostic(ErrorCode.ERR_MethDelegateMismatch, \"DelegatedMethod2\").WithArguments(\"DelegatedMethod2\", \"MyDelegate1\"),\n // (22,19): error CS0123: No overload for 'DelegatedMethod3' matches delegate 'MyDelegate1'\n // md1 += mc.DelegatedMethod3; // Invalid\n Diagnostic(ErrorCode.ERR_MethDelegateMismatch, \"DelegatedMethod3\").WithArguments(\"DelegatedMethod3\", \"MyDelegate1\"),\n // (24,19): error CS0123: No overload for 'DelegatedMethod2' matches delegate 'MyDelegate1'\n // md1 -= mc.DelegatedMethod2; // Invalid\n Diagnostic(ErrorCode.ERR_MethDelegateMismatch, \"DelegatedMethod2\").WithArguments(\"DelegatedMethod2\", \"MyDelegate1\"),\n // (25,19): error CS0123: No overload for 'DelegatedMethod3' matches delegate 'MyDelegate1'\n // md1 -= mc.DelegatedMethod3; // Invalid\n Diagnostic(ErrorCode.ERR_MethDelegateMismatch, \"DelegatedMethod3\").WithArguments(\"DelegatedMethod3\", \"MyDelegate1\")\n );\n }\n\n // Method List to removal or concatenation\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps04()\n {\n var text =\n@\"using System;\ndelegate void boo();\npublic class abc\n{\n public void bar() { System.Console.WriteLine(\"\"bar\"\"); }\n static public void far() { System.Console.WriteLine(\"\"far\"\"); }\n}\nclass C\n{\n static void Main(string[] args)\n {\n abc p = new abc();\n boo goo = null;\n boo goo1 = new boo(abc.far);\n boo[] arrfoo = { p.bar, abc.far };\n goo += arrfoo; // Invalid\n goo -= arrfoo; // Invalid\n goo += new boo[] { p.bar, abc.far };\t// Invalid\n goo -= new boo[] { p.bar, abc.far };\t// Invalid\n goo += Delegate.Combine(arrfoo);\t// Invalid\n goo += Delegate.Combine(goo, goo1); \t// Invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (16,16): error CS0029: Cannot implicitly convert type 'boo[]' to 'boo'\n // goo += arrfoo; // Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"arrfoo\").WithArguments(\"boo[]\", \"boo\"),\n // (17,16): error CS0029: Cannot implicitly convert type 'boo[]' to 'boo'\n // goo -= arrfoo; // Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"arrfoo\").WithArguments(\"boo[]\", \"boo\"),\n // (18,16): error CS0029: Cannot implicitly convert type 'boo[]' to 'boo'\n // goo += new boo[] { p.bar, abc.far };\t// Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"new boo[] { p.bar, abc.far }\").WithArguments(\"boo[]\", \"boo\"),\n // (19,16): error CS0029: Cannot implicitly convert type 'boo[]' to 'boo'\n // goo -= new boo[] { p.bar, abc.far };\t// Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"new boo[] { p.bar, abc.far }\").WithArguments(\"boo[]\", \"boo\"),\n // (20,16): error CS0266: Cannot implicitly convert type 'System.Delegate' to 'boo'. An explicit conversion exists (are you missing a cast?)\n // goo += Delegate.Combine(arrfoo);\t// Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConvCast, \"Delegate.Combine(arrfoo)\").WithArguments(\"System.Delegate\", \"boo\"),\n // (21,16): error CS0266: Cannot implicitly convert type 'System.Delegate' to 'boo'. An explicit conversion exists (are you missing a cast?)\n // goo += Delegate.Combine(goo, goo1); \t// Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConvCast, \"Delegate.Combine(goo, goo1)\").WithArguments(\"System.Delegate\", \"boo\")\n );\n }\n\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps05()\n {\n var text =\n@\"public delegate double MyDelegate1(ref int integerPortion, out float fraction);\npublic delegate double MyDelegate2(ref int integerPortion, out float fraction);\nclass C\n{\n static void Main(string[] args)\n {\n C mc = new C();\n MyDelegate1 md1 = null;\n MyDelegate2 md2 = null;\n md1 += md2; // Invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (10,16): error CS0029: Cannot implicitly convert type 'MyDelegate2' to 'MyDelegate1'\n // md1 += md2; // Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"md2\").WithArguments(\"MyDelegate2\", \"MyDelegate1\")\n );\n }\n\n // Anonymous method to removal or concatenation\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps06()\n {\n var text =\n@\"delegate void boo(int x);\nclass C\n{\n static void Main(string[] args)\n {\n boo goo = null;\n goo += delegate (string x) { System.Console.WriteLine(x); };// Invalid\n goo -= delegate (string x) { System.Console.WriteLine(x); };// Invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (7,16): error CS1661: Cannot convert anonymous method to delegate type 'boo' because the parameter types do not match the delegate parameter types\n // goo += delegate (string x) { System.Console.WriteLine(x); };// Invalid\n Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, \"delegate (string x) { System.Console.WriteLine(x); }\").WithArguments(\"anonymous method\", \"boo\"),\n // (7,33): error CS1678: Parameter 1 is declared as type 'string' but should be 'int'\n // goo += delegate (string x) { System.Console.WriteLine(x); };// Invalid\n Diagnostic(ErrorCode.ERR_BadParamType, \"x\").WithArguments(\"1\", \"\", \"string\", \"\", \"int\"),\n // (8,16): error CS1661: Cannot convert anonymous method to delegate type 'boo' because the parameter types do not match the delegate parameter types\n // goo -= delegate (string x) { System.Console.WriteLine(x); };// Invalid\n Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, \"delegate (string x) { System.Console.WriteLine(x); }\").WithArguments(\"anonymous method\", \"boo\"),\n // (8,33): error CS1678: Parameter 1 is declared as type 'string' but should be 'int'\n // goo -= delegate (string x) { System.Console.WriteLine(x); };// Invalid\n Diagnostic(ErrorCode.ERR_BadParamType, \"x\").WithArguments(\"1\", \"\", \"string\", \"\", \"int\")\n );\n }\n\n // Lambda expression to removal or concatenation\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps07()\n {\n var text =\n@\"delegate void boo(int x);\nclass C\n{\n static void Main(string[] args)\n {\n boo goo = null;\n goo += (string x) => { };// Invalid\n goo -= (string x) => { };// Invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (7,16): error CS1661: Cannot convert lambda expression to delegate type 'boo' because the parameter types do not match the delegate parameter types\n // goo += (string x) => { };// Invalid\n Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, \"(string x) => { }\").WithArguments(\"lambda expression\", \"boo\"),\n // (7,24): error CS1678: Parameter 1 is declared as type 'string' but should be 'int'\n // goo += (string x) => { };// Invalid\n Diagnostic(ErrorCode.ERR_BadParamType, \"x\").WithArguments(\"1\", \"\", \"string\", \"\", \"int\"),\n // (8,16): error CS1661: Cannot convert lambda expression to delegate type 'boo' because the parameter types do not match the delegate parameter types\n // goo -= (string x) => { };// Invalid\n Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, \"(string x) => { }\").WithArguments(\"lambda expression\", \"boo\"),\n // (8,24): error CS1678: Parameter 1 is declared as type 'string' but should be 'int'\n // goo -= (string x) => { };// Invalid\n Diagnostic(ErrorCode.ERR_BadParamType, \"x\").WithArguments(\"1\", \"\", \"string\", \"\", \"int\")\n );\n }\n\n // Successive operator for addition and subtraction assignment\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps08()\n {\n var text =\n@\"using System;\ndelegate void boo(int x);\nclass C\n{\n public void bar(int x) { Console.WriteLine(\"\"\"\", x); }\n static public void far(int x) { Console.WriteLine(\"\"far:{0}\"\", x); }\n static void Main(string[] args)\n {\n C p = new C();\n boo goo = null;\n goo += p.bar + far;// Invalid\n goo += (x) => { System.Console.WriteLine(\"\"Lambda:{0}\"\", x); } + far;// Invalid\n goo += delegate (int x) { System.Console.WriteLine(\"\"Anonymous:{0}\"\", x); } + far;// Invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (11,16): error CS0019: Operator '+' cannot be applied to operands of type 'method group' and 'method group'\n // goo += p.bar + far;// Invalid\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"p.bar + far\").WithArguments(\"+\", \"method group\", \"method group\").WithLocation(11, 16),\n // (12,16): error CS0019: Operator '+' cannot be applied to operands of type 'lambda expression' and 'method group'\n // goo += (x) => { System.Console.WriteLine(\"Lambda:{0}\", x); } + far;// Invalid\n Diagnostic(ErrorCode.ERR_BadBinaryOps, @\"(x) => { System.Console.WriteLine(\"\"Lambda:{0}\"\", x); } + far\").WithArguments(\"+\", \"lambda expression\", \"method group\").WithLocation(12, 16),\n // (12,70): warning CS8848: Operator '+' cannot be used here due to precedence. Use parentheses to disambiguate.\n // goo += (x) => { System.Console.WriteLine(\"Lambda:{0}\", x); } + far;// Invalid\n Diagnostic(ErrorCode.WRN_PrecedenceInversion, \"+\").WithArguments(\"+\").WithLocation(12, 70),\n // (13,16): error CS0019: Operator '+' cannot be applied to operands of type 'anonymous method' and 'method group'\n // goo += delegate (int x) { System.Console.WriteLine(\"Anonymous:{0}\", x); } + far;// Invalid\n Diagnostic(ErrorCode.ERR_BadBinaryOps, @\"delegate (int x) { System.Console.WriteLine(\"\"Anonymous:{0}\"\", x); } + far\").WithArguments(\"+\", \"anonymous method\", \"method group\").WithLocation(13, 16),\n // (13,83): warning CS8848: Operator '+' cannot be used here due to precedence. Use parentheses to disambiguate.\n // goo += delegate (int x) { System.Console.WriteLine(\"Anonymous:{0}\", x); } + far;// Invalid\n Diagnostic(ErrorCode.WRN_PrecedenceInversion, \"+\").WithArguments(\"+\").WithLocation(13, 83)\n );\n }\n\n // Removal or concatenation for the delegate on Variance\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps09()\n {\n var text =\n@\"using System.Collections.Generic;\n\ndelegate IList Delegate1(List x);\ndelegate IEnumerable Delegate2(IList x);\ndelegate IEnumerable Delegate3(IList x);\n\nclass C\n{\n public static List Method1(IList x)\n {\n return null;\n }\n\n public static IList Method1(IList x)\n {\n return null;\n }\n static void Main(string[] args)\n {\n Delegate1 d1 = Method1;\n d1 += Method1;\n Delegate2 d2 = Method1;\n d2 += Method1;\n Delegate3 d3 = Method1;\n d1 += d2; // invalid\n d2 += d1; // invalid\n d2 += d3; // invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (25,15): error CS0029: Cannot implicitly convert type 'Delegate2' to 'Delegate1'\n // d1 += d2; // invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"d2\").WithArguments(\"Delegate2\", \"Delegate1\"),\n // (26,15): error CS0029: Cannot implicitly convert type 'Delegate1' to 'Delegate2'\n // d2 += d1; // invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"d1\").WithArguments(\"Delegate1\", \"Delegate2\"),\n // (27,15): error CS0029: Cannot implicitly convert type 'Delegate3' to 'Delegate2'\n // d2 += d3; // invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"d3\").WithArguments(\"Delegate3\", \"Delegate2\")\n );\n }\n\n // generic-delegate (goo(...)) += non generic-methodgroup(bar(...))\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps10()\n {\n var text =\n@\"delegate void boo(T x);\nclass C\n{\n public void bar(int x) { System.Console.WriteLine(\"\"bar:{0}\"\", x); }\n public void bar1(string x) { System.Console.WriteLine(\"\"bar1:{0}\"\", x); }\n\n static void Main(string[] args)\n {\n C p = new C();\n boo goo = null;\n goo += p.bar;// OK\n goo += p.bar1;// Invalid\n goo += (x) => { System.Console.WriteLine(\"\"Lambda:{0}\"\", x); };// OK\n goo += (string x) => { System.Console.WriteLine(\"\"Lambda:{0}\"\", x); };// Invalid\n goo += delegate (int x) { System.Console.WriteLine(\"\"Anonymous:{0}\"\", x); };// OK\n goo += delegate (string x) { System.Console.WriteLine(\"\"Anonymous:{0}\"\", x); };// Invalid\n\n boo goo1 = null;\n goo1 += p.bar;// Invalid\n goo1 += p.bar1;// OK\n goo1 += (x) => { System.Console.WriteLine(\"\"Lambda:{0}\"\", x); };// OK\n goo1 += (int x) => { System.Console.WriteLine(\"\"Lambda:{0}\"\", x); };// Invalid\n goo1 += delegate (int x) { System.Console.WriteLine(\"\"Anonymous:{0}\"\", x); };// Invalid\n goo1 += delegate (string x) { System.Console.WriteLine(\"\"Anonymous:{0}\"\", x); };// OK\n goo += goo1;// Invalid\n goo1 += goo;// Invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (12,18): error CS0123: No overload for 'bar1' matches delegate 'boo'\n // goo += p.bar1;// Invalid\n Diagnostic(ErrorCode.ERR_MethDelegateMismatch, \"bar1\").WithArguments(\"bar1\", \"boo\"),\n // (14,16): error CS1661: Cannot convert lambda expression to delegate type 'boo' because the parameter types do not match the delegate parameter types\n // goo += (string x) => { System.Console.WriteLine(\"Lambda:{0}\", x); };// Invalid\n Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, @\"(string x) => { System.Console.WriteLine(\"\"Lambda:{0}\"\", x); }\").WithArguments(\"lambda expression\", \"boo\"),\n // (14,24): error CS1678: Parameter 1 is declared as type 'string' but should be 'int'\n // goo += (string x) => { System.Console.WriteLine(\"Lambda:{0}\", x); };// Invalid\n Diagnostic(ErrorCode.ERR_BadParamType, \"x\").WithArguments(\"1\", \"\", \"string\", \"\", \"int\"),\n // (16,16): error CS1661: Cannot convert anonymous method to delegate type 'boo' because the parameter types do not match the delegate parameter types\n // goo += delegate (string x) { System.Console.WriteLine(\"Anonymous:{0}\", x); };// Invalid\n Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, @\"delegate (string x) { System.Console.WriteLine(\"\"Anonymous:{0}\"\", x); }\").WithArguments(\"anonymous method\", \"boo\"),\n // (16,33): error CS1678: Parameter 1 is declared as type 'string' but should be 'int'\n // goo += delegate (string x) { System.Console.WriteLine(\"Anonymous:{0}\", x); };// Invalid\n Diagnostic(ErrorCode.ERR_BadParamType, \"x\").WithArguments(\"1\", \"\", \"string\", \"\", \"int\"),\n // (19,19): error CS0123: No overload for 'bar' matches delegate 'boo'\n // goo1 += p.bar;// Invalid\n Diagnostic(ErrorCode.ERR_MethDelegateMismatch, \"bar\").WithArguments(\"bar\", \"boo\"),\n // (22,17): error CS1661: Cannot convert lambda expression to delegate type 'boo' because the parameter types do not match the delegate parameter types\n // goo1 += (int x) => { System.Console.WriteLine(\"Lambda:{0}\", x); };// Invalid\n Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, @\"(int x) => { System.Console.WriteLine(\"\"Lambda:{0}\"\", x); }\").WithArguments(\"lambda expression\", \"boo\"),\n // (22,22): error CS1678: Parameter 1 is declared as type 'int' but should be 'string'\n // goo1 += (int x) => { System.Console.WriteLine(\"Lambda:{0}\", x); };// Invalid\n Diagnostic(ErrorCode.ERR_BadParamType, \"x\").WithArguments(\"1\", \"\", \"int\", \"\", \"string\"),\n // (23,17): error CS1661: Cannot convert anonymous method to delegate type 'boo' because the parameter types do not match the delegate parameter types\n // goo1 += delegate (int x) { System.Console.WriteLine(\"Anonymous:{0}\", x); };// Invalid\n Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, @\"delegate (int x) { System.Console.WriteLine(\"\"Anonymous:{0}\"\", x); }\").WithArguments(\"anonymous method\", \"boo\"),\n // (23,31): error CS1678: Parameter 1 is declared as type 'int' but should be 'string'\n // goo1 += delegate (int x) { System.Console.WriteLine(\"Anonymous:{0}\", x); };// Invalid\n Diagnostic(ErrorCode.ERR_BadParamType, \"x\").WithArguments(\"1\", \"\", \"int\", \"\", \"string\"),\n // (25,16): error CS0029: Cannot implicitly convert type 'boo' to 'boo'\n // goo += goo1;// Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"goo1\").WithArguments(\"boo\", \"boo\"),\n // (26,17): error CS0029: Cannot implicitly convert type 'boo' to 'boo'\n // goo1 += goo;// Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"goo\").WithArguments(\"boo\", \"boo\")\n );\n }\n\n // generic-delegate (goo(...)) += generic-methodgroup(bar(...))\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps11()\n {\n var text =\n@\"delegate void boo(T x);\nclass C\n{\n static void far(T x) { }\n static void Main(string[] args)\n {\n C p = new C();\n boo goo = null;\n goo += far;// OK\n goo += far;// Invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (10,16): error CS0123: No overload for 'far' matches delegate 'boo'\n // goo += far;// Invalid\n Diagnostic(ErrorCode.ERR_MethDelegateMismatch, \"far\").WithArguments(\"far\", \"boo\")\n );\n }\n\n // non generic-delegate (goo(...)) += generic-methodgroup(bar(...))\n [WorkItem(539906, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539906\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps12()\n {\n var text =\n@\"delegate void boo(T x);\nclass C\n{\n static void far(T x) { }\n static void Main(string[] args)\n {\n C p = new C();\n boo goo = null;\n goo += far;// OK\n goo += far;// Invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (10,16): error CS0123: No overload for 'far' matches delegate 'boo'\n // goo += far;// Invalid\n Diagnostic(ErrorCode.ERR_MethDelegateMismatch, \"far\").WithArguments(\"far\", \"boo\")\n );\n }\n\n // distinguish '|' from '||'\n [WorkItem(540235, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540235\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps13()\n {\n var text = @\"\nclass C\n{\n int a = 1 | 1;\n int b = 1 & 1;\n int c = 1 || 1;\n int d = 1 && 1;\n\n bool e = true | true;\n bool f = true & true;\n bool g = true || true;\n bool h = true && true;\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,13): error CS0019: Operator '||' cannot be applied to operands of type 'int' and 'int'\n // int c = 1 || 1;\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"1 || 1\").WithArguments(\"||\", \"int\", \"int\"),\n // (7,13): error CS0019: Operator '&&' cannot be applied to operands of type 'int' and 'int'\n // int d = 1 && 1;\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"1 && 1\").WithArguments(\"&&\", \"int\", \"int\"),\n // (4,9): warning CS0414: The field 'C.a' is assigned but its value is never used\n // int a = 1 | 1;\n Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, \"a\").WithArguments(\"C.a\"),\n // (5,9): warning CS0414: The field 'C.b' is assigned but its value is never used\n // int b = 1 & 1;\n Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, \"b\").WithArguments(\"C.b\"),\n // (9,10): warning CS0414: The field 'C.e' is assigned but its value is never used\n // bool e = true | true;\n Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, \"e\").WithArguments(\"C.e\"),\n // (10,10): warning CS0414: The field 'C.f' is assigned but its value is never used\n // bool f = true & true;\n Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, \"f\").WithArguments(\"C.f\"),\n // (11,10): warning CS0414: The field 'C.g' is assigned but its value is never used\n // bool g = true || true;\n Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, \"g\").WithArguments(\"C.g\"),\n // (12,10): warning CS0414: The field 'C.h' is assigned but its value is never used\n // bool h = true && true;\n Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, \"h\").WithArguments(\"C.h\"));\n }\n\n /// \n /// Conversion errors for Null Coalescing operator(??)\n /// \n [Fact]\n public void CS0019ERR_BadBinaryOps14()\n {\n var text = @\"\npublic class D { }\npublic class Error\n{\n public int? NonNullableValueType_a(int a)\n {\n int? b = null;\n int? z = a ?? b;\n return z;\n }\n public int? NonNullableValueType_b(char ch)\n {\n char b = ch;\n int? z = null ?? b;\n return z;\n }\n public int NonNullableValueType_const_a(char ch)\n {\n char b = ch;\n int z = 10 ?? b;\n return z;\n }\n public D NoPossibleConversionError()\n {\n D b = new D();\n Error a = null;\n D z = a ?? b;\n return z;\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (7,18): error CS0019: Operator '??' cannot be applied to operands of type 'int' and 'int?'\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"a ?? b\").WithArguments(\"??\", \"int\", \"int?\"),\n // (13,18): error CS0019: Operator '??' cannot be applied to operands of type '' and 'char'\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"null ?? b\").WithArguments(\"??\", \"\", \"char\"),\n // (19,17): error CS0019: Operator '??' cannot be applied to operands of type 'int' and 'char'\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"10 ?? b\").WithArguments(\"??\", \"int\", \"char\"),\n // (26,15): error CS0019: Operator '??' cannot be applied to operands of type 'Error' and 'D'\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"a ?? b\").WithArguments(\"??\", \"Error\", \"D\"));\n }\n\n [WorkItem(542115, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542115\")]\n [Fact]\n public void CS0019ERR_BadBinaryOps15()\n {\n var text =\n@\"class C\n{\n static void M(T1 t1, T2 t2, T3 t3, T4 t4, int i, C c)\n where T2 : class\n where T3 : struct\n where T4 : T1\n {\n bool b;\n b = (t1 == t1);\n b = (t1 == t2);\n b = (t1 == t3);\n b = (t1 == t4);\n b = (t1 == i);\n b = (t1 == c);\n b = (t1 == null);\n b = (t2 == t1);\n b = (t2 == t2);\n b = (t2 == t3);\n b = (t2 == t4);\n b = (t2 == i);\n b = (t2 == c);\n b = (t2 == null);\n b = (t3 == t1);\n b = (t3 == t2);\n b = (t3 == t3);\n b = (t3 == t4);\n b = (t3 == i);\n b = (t3 == c);\n b = (t3 == null);\n b = (t4 != t1);\n b = (t4 != t2);\n b = (t4 != t3);\n b = (t4 != t4);\n b = (t4 != i);\n b = (t4 != c);\n b = (t4 != null);\n b = (i != t1);\n b = (i != t2);\n b = (i != t3);\n b = (i != t4);\n b = (i != i);\n b = (i != c);\n b = (i != null);\n b = (c != t1);\n b = (c != t2);\n b = (c != t3);\n b = (c != t4);\n b = (c != i);\n b = (c != c);\n b = (c != null);\n b = (null != t1);\n b = (null != t2);\n b = (null != t3);\n b = (null != t4);\n b = (null != i);\n b = (null != c);\n b = (null != null);\n }\n}\";\n CreateCompilation(text).VerifyDiagnostics(\n // (9,14): error CS0019: Operator '==' cannot be applied to operands of type 'T1' and 'T1'\n // b = (t1 == t1);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t1 == t1\").WithArguments(\"==\", \"T1\", \"T1\"),\n // (10,14): error CS0019: Operator '==' cannot be applied to operands of type 'T1' and 'T2'\n // b = (t1 == t2);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t1 == t2\").WithArguments(\"==\", \"T1\", \"T2\"),\n // (11,14): error CS0019: Operator '==' cannot be applied to operands of type 'T1' and 'T3'\n // b = (t1 == t3);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t1 == t3\").WithArguments(\"==\", \"T1\", \"T3\"),\n // (12,14): error CS0019: Operator '==' cannot be applied to operands of type 'T1' and 'T4'\n // b = (t1 == t4);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t1 == t4\").WithArguments(\"==\", \"T1\", \"T4\"),\n // (13,14): error CS0019: Operator '==' cannot be applied to operands of type 'T1' and 'int'\n // b = (t1 == i);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t1 == i\").WithArguments(\"==\", \"T1\", \"int\"),\n // (14,14): error CS0019: Operator '==' cannot be applied to operands of type 'T1' and 'C'\n // b = (t1 == c);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t1 == c\").WithArguments(\"==\", \"T1\", \"C\"),\n // (16,14): error CS0019: Operator '==' cannot be applied to operands of type 'T2' and 'T1'\n // b = (t2 == t1);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t2 == t1\").WithArguments(\"==\", \"T2\", \"T1\"),\n // (18,14): error CS0019: Operator '==' cannot be applied to operands of type 'T2' and 'T3'\n // b = (t2 == t3);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t2 == t3\").WithArguments(\"==\", \"T2\", \"T3\"),\n // (19,14): error CS0019: Operator '==' cannot be applied to operands of type 'T2' and 'T4'\n // b = (t2 == t4);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t2 == t4\").WithArguments(\"==\", \"T2\", \"T4\"),\n // (20,14): error CS0019: Operator '==' cannot be applied to operands of type 'T2' and 'int'\n // b = (t2 == i);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t2 == i\").WithArguments(\"==\", \"T2\", \"int\"),\n // (23,14): error CS0019: Operator '==' cannot be applied to operands of type 'T3' and 'T1'\n // b = (t3 == t1);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t3 == t1\").WithArguments(\"==\", \"T3\", \"T1\"),\n // (24,14): error CS0019: Operator '==' cannot be applied to operands of type 'T3' and 'T2'\n // b = (t3 == t2);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t3 == t2\").WithArguments(\"==\", \"T3\", \"T2\"),\n // (25,14): error CS0019: Operator '==' cannot be applied to operands of type 'T3' and 'T3'\n // b = (t3 == t3);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t3 == t3\").WithArguments(\"==\", \"T3\", \"T3\"),\n // (26,14): error CS0019: Operator '==' cannot be applied to operands of type 'T3' and 'T4'\n // b = (t3 == t4);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t3 == t4\").WithArguments(\"==\", \"T3\", \"T4\"),\n // (27,14): error CS0019: Operator '==' cannot be applied to operands of type 'T3' and 'int'\n // b = (t3 == i);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t3 == i\").WithArguments(\"==\", \"T3\", \"int\"),\n // (28,14): error CS0019: Operator '==' cannot be applied to operands of type 'T3' and 'C'\n // b = (t3 == c);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t3 == c\").WithArguments(\"==\", \"T3\", \"C\"),\n // (29,14): error CS0019: Operator '==' cannot be applied to operands of type 'T3' and ''\n // b = (t3 == null);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t3 == null\").WithArguments(\"==\", \"T3\", \"\"),\n // (30,14): error CS0019: Operator '!=' cannot be applied to operands of type 'T4' and 'T1'\n // b = (t4 != t1);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t4 != t1\").WithArguments(\"!=\", \"T4\", \"T1\"),\n // (31,14): error CS0019: Operator '!=' cannot be applied to operands of type 'T4' and 'T2'\n // b = (t4 != t2);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t4 != t2\").WithArguments(\"!=\", \"T4\", \"T2\"),\n // (32,14): error CS0019: Operator '!=' cannot be applied to operands of type 'T4' and 'T3'\n // b = (t4 != t3);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t4 != t3\").WithArguments(\"!=\", \"T4\", \"T3\"),\n // (33,14): error CS0019: Operator '!=' cannot be applied to operands of type 'T4' and 'T4'\n // b = (t4 != t4);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t4 != t4\").WithArguments(\"!=\", \"T4\", \"T4\"),\n // (34,14): error CS0019: Operator '!=' cannot be applied to operands of type 'T4' and 'int'\n // b = (t4 != i);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t4 != i\").WithArguments(\"!=\", \"T4\", \"int\"),\n // (35,14): error CS0019: Operator '!=' cannot be applied to operands of type 'T4' and 'C'\n // b = (t4 != c);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t4 != c\").WithArguments(\"!=\", \"T4\", \"C\"),\n // (37,14): error CS0019: Operator '!=' cannot be applied to operands of type 'int' and 'T1'\n // b = (i != t1);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"i != t1\").WithArguments(\"!=\", \"int\", \"T1\"),\n // (38,14): error CS0019: Operator '!=' cannot be applied to operands of type 'int' and 'T2'\n // b = (i != t2);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"i != t2\").WithArguments(\"!=\", \"int\", \"T2\"),\n // (39,14): error CS0019: Operator '!=' cannot be applied to operands of type 'int' and 'T3'\n // b = (i != t3);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"i != t3\").WithArguments(\"!=\", \"int\", \"T3\"),\n // (40,14): error CS0019: Operator '!=' cannot be applied to operands of type 'int' and 'T4'\n // b = (i != t4);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"i != t4\").WithArguments(\"!=\", \"int\", \"T4\"),\n // (42,14): error CS0019: Operator '!=' cannot be applied to operands of type 'int' and 'C'\n // b = (i != c);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"i != c\").WithArguments(\"!=\", \"int\", \"C\"),\n // (44,14): error CS0019: Operator '!=' cannot be applied to operands of type 'C' and 'T1'\n // b = (c != t1);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"c != t1\").WithArguments(\"!=\", \"C\", \"T1\"),\n // (46,14): error CS0019: Operator '!=' cannot be applied to operands of type 'C' and 'T3'\n // b = (c != t3);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"c != t3\").WithArguments(\"!=\", \"C\", \"T3\"),\n // (47,14): error CS0019: Operator '!=' cannot be applied to operands of type 'C' and 'T4'\n // b = (c != t4);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"c != t4\").WithArguments(\"!=\", \"C\", \"T4\"),\n // (48,14): error CS0019: Operator '!=' cannot be applied to operands of type 'C' and 'int'\n // b = (c != i);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"c != i\").WithArguments(\"!=\", \"C\", \"int\"),\n // (53,14): error CS0019: Operator '!=' cannot be applied to operands of type '' and 'T3'\n // b = (null != t3);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"null != t3\").WithArguments(\"!=\", \"\", \"T3\"),\n // (17,14): warning CS1718: Comparison made to same variable; did you mean to compare something else?\n // b = (t2 == t2);\n Diagnostic(ErrorCode.WRN_ComparisonToSelf, \"t2 == t2\"),\n // (41,14): warning CS1718: Comparison made to same variable; did you mean to compare something else?\n // b = (i != i);\n Diagnostic(ErrorCode.WRN_ComparisonToSelf, \"i != i\"),\n // (43,14): warning CS0472: The result of the expression is always 'true' since a value of type 'int' is never equal to 'null' of type 'int?'\n // b = (i != null);\n Diagnostic(ErrorCode.WRN_NubExprIsConstBool, \"i != null\").WithArguments(\"true\", \"int\", \"int?\"),\n // (49,14): warning CS1718: Comparison made to same variable; did you mean to compare something else?\n // b = (c != c);\n Diagnostic(ErrorCode.WRN_ComparisonToSelf, \"c != c\"),\n // (55,14): warning CS0472: The result of the expression is always 'true' since a value of type 'int' is never equal to 'null' of type 'int?'\n // b = (null != i);\n Diagnostic(ErrorCode.WRN_NubExprIsConstBool, \"null != i\").WithArguments(\"true\", \"int\", \"int?\"));\n }\n\n [Fact]\n public void CS0019ERR_BadBinaryOps16()\n {\n var text =\n@\"class A { }\nclass B : A { }\ninterface I { }\nclass C\n{\n static void M(T t, U u, A a, B b, C c, I i)\n where T : A\n where U : B\n {\n bool x;\n x = (t == t);\n x = (t == u);\n x = (t == a);\n x = (t == b);\n x = (t == c);\n x = (t == i);\n x = (u == t);\n x = (u == u);\n x = (u == a);\n x = (u == b);\n x = (u == c);\n x = (u == i);\n x = (a == t);\n x = (a == u);\n x = (a == a);\n x = (a == b);\n x = (a == c);\n x = (a == i);\n x = (b == t);\n x = (b == u);\n x = (b == a);\n x = (b == b);\n x = (b == c);\n x = (b == i);\n x = (c == t);\n x = (c == u);\n x = (c == a);\n x = (c == b);\n x = (c == c);\n x = (c == i);\n x = (i == t);\n x = (i == u);\n x = (i == a);\n x = (i == b);\n x = (i == c);\n x = (i == i);\n }\n}\";\n CreateCompilation(text).VerifyDiagnostics(\n // (15,14): error CS0019: Operator '==' cannot be applied to operands of type 'T' and 'C'\n // x = (t == c);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"t == c\").WithArguments(\"==\", \"T\", \"C\"),\n // (21,14): error CS0019: Operator '==' cannot be applied to operands of type 'U' and 'C'\n // x = (u == c);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"u == c\").WithArguments(\"==\", \"U\", \"C\"),\n // (27,14): error CS0019: Operator '==' cannot be applied to operands of type 'A' and 'C'\n // x = (a == c);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"a == c\").WithArguments(\"==\", \"A\", \"C\"),\n // (33,14): error CS0019: Operator '==' cannot be applied to operands of type 'B' and 'C'\n // x = (b == c);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"b == c\").WithArguments(\"==\", \"B\", \"C\"),\n // (35,14): error CS0019: Operator '==' cannot be applied to operands of type 'C' and 'T'\n // x = (c == t);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"c == t\").WithArguments(\"==\", \"C\", \"T\"),\n // (36,14): error CS0019: Operator '==' cannot be applied to operands of type 'C' and 'U'\n // x = (c == u);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"c == u\").WithArguments(\"==\", \"C\", \"U\"),\n // (37,14): error CS0019: Operator '==' cannot be applied to operands of type 'C' and 'A'\n // x = (c == a);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"c == a\").WithArguments(\"==\", \"C\", \"A\"),\n // (38,14): error CS0019: Operator '==' cannot be applied to operands of type 'C' and 'B'\n // x = (c == b);\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"c == b\").WithArguments(\"==\", \"C\", \"B\"),\n // (11,14): warning CS1718: Comparison made to same variable; did you mean to compare something else?\n // x = (t == t);\n Diagnostic(ErrorCode.WRN_ComparisonToSelf, \"t == t\"),\n // (18,14): warning CS1718: Comparison made to same variable; did you mean to compare something else?\n // x = (u == u);\n Diagnostic(ErrorCode.WRN_ComparisonToSelf, \"u == u\"),\n // (25,14): warning CS1718: Comparison made to same variable; did you mean to compare something else?\n // x = (a == a);\n Diagnostic(ErrorCode.WRN_ComparisonToSelf, \"a == a\"),\n // (32,14): warning CS1718: Comparison made to same variable; did you mean to compare something else?\n // x = (b == b);\n Diagnostic(ErrorCode.WRN_ComparisonToSelf, \"b == b\"),\n // (39,14): warning CS1718: Comparison made to same variable; did you mean to compare something else?\n // x = (c == c);\n Diagnostic(ErrorCode.WRN_ComparisonToSelf, \"c == c\"),\n // (46,14): warning CS1718: Comparison made to same variable; did you mean to compare something else?\n // x = (i == i);\n Diagnostic(ErrorCode.WRN_ComparisonToSelf, \"i == i\"));\n }\n\n [Fact]\n public void CS0019ERR_BadBinaryOps17()\n {\n var text =\n@\"struct S { }\nabstract class A\n{\n internal virtual void M(U u) where U : T\n {\n bool b;\n b = (u == null);\n b = (null != u);\n }\n}\nclass B : A\n{\n internal override void M(U u)\n {\n bool b;\n b = (u == null);\n b = (null != u);\n }\n}\";\n CreateCompilation(text).VerifyDiagnostics(\n // (16,14): error CS0019: Operator '==' cannot be applied to operands of type 'U' and ''\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"u == null\").WithArguments(\"==\", \"U\", \"\").WithLocation(16, 14),\n // (17,14): error CS0019: Operator '!=' cannot be applied to operands of type '' and 'U'\n Diagnostic(ErrorCode.ERR_BadBinaryOps, \"null != u\").WithArguments(\"!=\", \"\", \"U\").WithLocation(17, 14));\n }\n\n [Fact]\n public void CS0020ERR_IntDivByZero()\n {\n var text = @\"\nnamespace x\n{\n public class b\n {\n public static int Main()\n {\n int s = 1 / 0; // CS0020\n return s;\n }\n }\n}\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text,\n new ErrorDescription[] { new ErrorDescription { Code = (int)ErrorCode.ERR_IntDivByZero, Line = 8, Column = 21 } });\n }\n\n [Fact]\n public void CS0020ERR_IntDivByZero_02()\n {\n var text = @\"\nnamespace x\n{\n public class b\n {\n public static void Main()\n {\n decimal x1 = 1.20M / 0; // CS0020\n decimal x2 = 1.20M / decimal.Zero; // CS0020\n decimal x3 = decimal.MaxValue / decimal.Zero; // CS0020\n }\n }\n}\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text,\n new ErrorDescription[] {\n new ErrorDescription { Code = (int)ErrorCode.ERR_IntDivByZero, Line = 8, Column = 26 },\n new ErrorDescription { Code = (int)ErrorCode.ERR_IntDivByZero, Line = 9, Column = 26 },\n new ErrorDescription { Code = (int)ErrorCode.ERR_IntDivByZero, Line = 10, Column = 26 } });\n }\n\n [Fact]\n public void CS0021ERR_BadIndexLHS()\n {\n var text =\n@\"enum E { }\nclass C\n{\n static void M()\n {\n object o;\n o = M[0];\n o = ((System.Action)null)[0];\n o = ((dynamic)o)[0];\n o = default(E)[0];\n o = default(T)[0];\n o = (new C())[0];\n }\n}\";\n CreateCompilation(text).VerifyDiagnostics(\n // (7,13): error CS0021: Cannot apply indexing with [] to an expression of type 'method group'\n Diagnostic(ErrorCode.ERR_BadIndexLHS, \"M[0]\").WithArguments(\"method group\").WithLocation(7, 13),\n // (8,13): error CS0021: Cannot apply indexing with [] to an expression of type 'System.Action'\n Diagnostic(ErrorCode.ERR_BadIndexLHS, \"((System.Action)null)[0]\").WithArguments(\"System.Action\").WithLocation(8, 13),\n // (10,13): error CS0021: Cannot apply indexing with [] to an expression of type 'E'\n Diagnostic(ErrorCode.ERR_BadIndexLHS, \"default(E)[0]\").WithArguments(\"E\").WithLocation(10, 13),\n // (11,13): error CS0021: Cannot apply indexing with [] to an expression of type 'T'\n Diagnostic(ErrorCode.ERR_BadIndexLHS, \"default(T)[0]\").WithArguments(\"T\").WithLocation(11, 13),\n // (12,13): error CS0021: Cannot apply indexing with [] to an expression of type 'C'\n Diagnostic(ErrorCode.ERR_BadIndexLHS, \"(new C())[0]\").WithArguments(\"C\").WithLocation(12, 13));\n }\n\n [Fact]\n public void CS0022ERR_BadIndexCount()\n {\n var text = @\"\nnamespace x\n{\n public class b\n {\n public static void Main()\n {\n int[,] a = new int[10,2] ;\n a[2] = 4; //bad index count in access\n }\n }\n}\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text,\n new ErrorDescription[] { new ErrorDescription { Code = (int)ErrorCode.ERR_BadIndexCount, Line = 9, Column = 25 } });\n }\n\n [WorkItem(542486, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542486\")]\n [Fact]\n public void CS0022ERR_BadIndexCount02()\n {\n var text = @\"\nclass Program\n{\n static void Main(string[] args)\n {\n int[,] a = new int[1 2]; //bad index count in size specifier - no initializer\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,30): error CS1003: Syntax error, ',' expected\n Diagnostic(ErrorCode.ERR_SyntaxError, \"2\").WithArguments(\",\", \"\"));\n }\n\n [WorkItem(542486, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542486\")]\n [Fact]\n public void CS0022ERR_BadIndexCount03()\n {\n var text = @\"\nclass Program\n{\n static void Main(string[] args)\n {\n int[,] a = new int[1 2] { 1 }; //bad index count in size specifier - with initializer\n }\n}\n\";\n // NOTE: Dev10 just gives a parse error on '2'\n CreateCompilation(text).VerifyDiagnostics(\n // (6,30): error CS1003: Syntax error, ',' expected\n Diagnostic(ErrorCode.ERR_SyntaxError, \"2\").WithArguments(\",\", \"\"),\n // (6,35): error CS0846: A nested array initializer is expected\n Diagnostic(ErrorCode.ERR_ArrayInitializerExpected, \"1\"));\n }\n\n [WorkItem(542486, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542486\")]\n [Fact]\n public void CS0022ERR_BadIndexCount04()\n {\n var text = @\"\nclass Program\n{\n static void Main(string[] args)\n {\n int[,] a = new int[1,]; //bad index count in size specifier - no initializer\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,30): error CS0443: Syntax error; value expected\n Diagnostic(ErrorCode.ERR_ValueExpected, \"\"));\n }\n\n [WorkItem(542486, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542486\")]\n [Fact]\n public void CS0022ERR_BadIndexCount05()\n {\n var text = @\"\nclass Program\n{\n static void Main(string[] args)\n {\n int[,] a = new int[1,] { { 1 } }; //bad index count in size specifier - with initializer\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,30): error CS0443: Syntax error; value expected\n Diagnostic(ErrorCode.ERR_ValueExpected, \"\"));\n }\n\n [WorkItem(539590, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539590\")]\n [Fact]\n public void CS0023ERR_BadUnaryOp1()\n {\n var text = @\"\nnamespace X\n{\n class C\n {\n object M()\n {\n object q = new object();\n if (!q) // CS0023\n { }\n\n object obj = -null; // CS0023\n obj = !null; // CS0023\n obj = ~null; // CS0023\n\n obj++; // CS0023\n --obj; // CS0023\n return +null; // CS0023\n }\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (9,17): error CS0023: Operator '!' cannot be applied to operand of type 'object'\n // if (!q) // CS0023\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \"!q\").WithArguments(\"!\", \"object\").WithLocation(9, 17),\n // (12,26): error CS8310: Operator '-' cannot be applied to operand ''\n // object obj = -null; // CS0023\n Diagnostic(ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, \"-null\").WithArguments(\"-\", \"\").WithLocation(12, 26),\n // (13,19): error CS8310: Operator '!' cannot be applied to operand ''\n // obj = !null; // CS0023\n Diagnostic(ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, \"!null\").WithArguments(\"!\", \"\").WithLocation(13, 19),\n // (14,19): error CS8310: Operator '~' cannot be applied to operand ''\n // obj = ~null; // CS0023\n Diagnostic(ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, \"~null\").WithArguments(\"~\", \"\").WithLocation(14, 19),\n // (16,13): error CS0023: Operator '++' cannot be applied to operand of type 'object'\n // obj++; // CS0023\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \"obj++\").WithArguments(\"++\", \"object\").WithLocation(16, 13),\n // (17,13): error CS0023: Operator '--' cannot be applied to operand of type 'object'\n // --obj; // CS0023\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \"--obj\").WithArguments(\"--\", \"object\").WithLocation(17, 13),\n // (18,20): error CS8310: Operator '+' cannot be applied to operand ''\n // return +null; // CS0023\n Diagnostic(ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, \"+null\").WithArguments(\"+\", \"\").WithLocation(18, 20)\n );\n }\n\n [WorkItem(539590, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539590\")]\n [Fact]\n public void CS0023ERR_BadUnaryOp_Nullable()\n {\n var text = @\"\npublic class Test\n{\n public static void Main()\n {\n bool? b = !null; // CS0023\n int? n = ~null; // CS0023\n float? f = +null; // CS0023\n long? u = -null; // CS0023\n\n ++n;\n n--;\n --u;\n u++;\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,19): error CS8310: Operator '!' cannot be applied to operand ''\n // bool? b = !null; // CS0023\n Diagnostic(ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, \"!null\").WithArguments(\"!\", \"\").WithLocation(6, 19),\n // (7,18): error CS8310: Operator '~' cannot be applied to operand ''\n // int? n = ~null; // CS0023\n Diagnostic(ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, \"~null\").WithArguments(\"~\", \"\").WithLocation(7, 18),\n // (8,20): error CS8310: Operator '+' cannot be applied to operand ''\n // float? f = +null; // CS0023\n Diagnostic(ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, \"+null\").WithArguments(\"+\", \"\").WithLocation(8, 20),\n // (9,19): error CS8310: Operator '-' cannot be applied to operand ''\n // long? u = -null; // CS0023\n Diagnostic(ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, \"-null\").WithArguments(\"-\", \"\").WithLocation(9, 19)\n );\n }\n\n [WorkItem(539590, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539590\")]\n [Fact]\n public void CS0023ERR_BadUnaryOp2()\n {\n var text = @\"\nnamespace X\n{\n class C\n {\n void M()\n {\n System.Action f = M;\n f = +M; // CS0023\n f = +(() => { }); // CS0023\n }\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (9,17): error CS0023: Operator '+' cannot be applied to operand of type 'method group'\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \"+M\").WithArguments(\"+\", \"method group\"),\n // (10,17): error CS0023: Operator '+' cannot be applied to operand of type 'lambda expression'\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \"+(() => { })\").WithArguments(\"+\", \"lambda expression\"));\n }\n\n [WorkItem(540211, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540211\")]\n [Fact]\n public void CS0023ERR_BadUnaryOp_VoidMissingInstanceMethod()\n {\n var text = @\"class C\n{\n void M()\n {\n M().Goo();\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (5,12): error CS0023: Operator '.' cannot be applied to operand of type 'void'\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \".\").WithArguments(\".\", \"void\"));\n }\n\n [WorkItem(540211, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540211\")]\n [Fact]\n public void CS0023ERR_BadUnaryOp_VoidToString()\n {\n var text = @\"class C\n{\n void M()\n {\n M().ToString(); //plausible, but still wrong\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (5,12): error CS0023: Operator '.' cannot be applied to operand of type 'void'\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \".\").WithArguments(\".\", \"void\"));\n }\n\n [WorkItem(540329, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540329\")]\n [Fact]\n public void CS0023ERR_BadUnaryOp_null()\n {\n var text = @\"\nclass X\n{\n static void Main()\n {\n int x = null.Length;\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \"null.Length\").WithArguments(\".\", \"\"));\n }\n\n [WorkItem(540329, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540329\")]\n [Fact]\n public void CS0023ERR_BadUnaryOp_lambdaExpression()\n {\n var text = @\"\nclass X\n{\n static void Main()\n {\n System.Func f = arg => { arg = 2; return arg; }.ToString();\n \n var x = delegate { }.ToString();\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \"arg => { arg = 2; return arg; }.ToString\").WithArguments(\".\", \"lambda expression\"),\n Diagnostic(ErrorCode.ERR_BadUnaryOp, \"delegate { }.ToString\").WithArguments(\".\", \"anonymous method\"));\n }\n\n [Fact]\n public void CS0026ERR_ThisInStaticMeth()\n {\n var text = @\"\npublic class MyClass\n{\n public static int i = 0;\n\n public static void Main()\n {\n // CS0026\n this.i = this.i + 1;\n }\n}\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text,\n new ErrorDescription[] {\n new ErrorDescription { Code = (int)ErrorCode.ERR_ThisInStaticMeth, Line = 9, Column = 9 },\n new ErrorDescription { Code = (int)ErrorCode.ERR_ObjectProhibited, Line = 9, Column = 9 },\n new ErrorDescription { Code = (int)ErrorCode.ERR_ThisInStaticMeth, Line = 9, Column = 18 },\n new ErrorDescription { Code = (int)ErrorCode.ERR_ObjectProhibited, Line = 9, Column = 18 }\n });\n }\n\n [Fact]\n public void CS0026ERR_ThisInStaticMeth_StaticConstructor()\n {\n var text = @\"\npublic class MyClass\n{\n int f;\n void M() { }\n int P { get; set; }\n\n static MyClass()\n {\n this.f = this.P;\n this.M();\n }\n}\";\n CreateCompilation(text).VerifyDiagnostics(\n // (10,9): error CS0026: Keyword 'this' is not valid in a static property, static method, or static field initializer\n Diagnostic(ErrorCode.ERR_ThisInStaticMeth, \"this\"),\n // (10,18): error CS0026: Keyword 'this' is not valid in a static property, static method, or static field initializer\n Diagnostic(ErrorCode.ERR_ThisInStaticMeth, \"this\"),\n // (11,9): error CS0026: Keyword 'this' is not valid in a static property, static method, or static field initializer\n Diagnostic(ErrorCode.ERR_ThisInStaticMeth, \"this\"));\n }\n\n [Fact]\n public void CS0026ERR_ThisInStaticMeth_Combined()\n {\n var text = @\"\nusing System;\n\nclass CLS\n{\n static CLS() { var x = this.ToString(); }\n static object FLD = this.ToString();\n static object PROP { get { return this.ToString(); } }\n static object METHOD() { return this.ToString(); }\n}\n\nclass A : Attribute\n{\n public object P;\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (7,25): error CS0026: Keyword 'this' is not valid in a static property, static method, or static field initializer\n // static object FLD = this.ToString();\n Diagnostic(ErrorCode.ERR_ThisInStaticMeth, \"this\"),\n // (6,28): error CS0026: Keyword 'this' is not valid in a static property, static method, or static field initializer\n // static CLS() { var x = this.ToString(); }\n Diagnostic(ErrorCode.ERR_ThisInStaticMeth, \"this\"),\n // (8,39): error CS0026: Keyword 'this' is not valid in a static property, static method, or static field initializer\n // static object PROP { get { return this.ToString(); } }\n Diagnostic(ErrorCode.ERR_ThisInStaticMeth, \"this\"),\n // (9,37): error CS0026: Keyword 'this' is not valid in a static property, static method, or static field initializer\n // static object METHOD() { return this.ToString(); }\n Diagnostic(ErrorCode.ERR_ThisInStaticMeth, \"this\"),\n // (14,19): warning CS0649: Field 'A.P' is never assigned to, and will always have its default value null\n // public object P;\n Diagnostic(ErrorCode.WRN_UnassignedInternalField, \"P\").WithArguments(\"A.P\", \"null\")\n );\n }\n\n [Fact]\n public void CS0027ERR_ThisInBadContext()\n {\n var text = @\"\nnamespace ConsoleApplication3\n{\n class MyClass\n {\n int err1 = this.Fun() + 1; // CS0027 \n public void Fun()\n {\n }\n }\n}\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text,\n new ErrorDescription[] { new ErrorDescription { Code = (int)ErrorCode.ERR_ThisInBadContext, Line = 6, Column = 20 } });\n }\n\n [Fact]\n public void CS0027ERR_ThisInBadContext_2()\n {\n var text = @\"\nusing System;\n\n[assembly: A(P = this.ToString())]\n\nclass A : Attribute\n{\n public object P;\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (4,18): error CS0027: Keyword 'this' is not available in the current context\n // [assembly: A(P = this.ToString())]\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\"));\n }\n\n [Fact]\n public void CS0027ERR_ThisInBadContext_Interactive()\n {\n string text = @\"\nint a;\nint b = a;\nint c = this.a; // 1\nthis.c = // 2\n this.a; // 3\nint prop { get { return 1; } set { this.a = 1;} } // 4\n\nvoid goo() {\n this.goo(); // 5\n this.a = // 6\n this.b; // 7\n object c = this; // 8\n}\n\nthis.prop = 1; // 9\n\nclass C\n{\n C() : base()\n {\n }\n\n void goo()\n {\n this.goo(); // OK\n }\n}\";\n var comp = CreateCompilationWithMscorlib45(\n new[] { SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Script) });\n comp.VerifyDiagnostics(\n // (4,9): error CS0027: Keyword 'this' is not available in the current context\n // int c = this.a; // 1\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\").WithLocation(4, 9),\n // (5,1): error CS0027: Keyword 'this' is not available in the current context\n // this.c = // 2\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\").WithLocation(5, 1),\n // (6,5): error CS0027: Keyword 'this' is not available in the current context\n // this.a; // 3\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\").WithLocation(6, 5),\n // (16,1): error CS0027: Keyword 'this' is not available in the current context\n // this.prop = 1; // 9\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\").WithLocation(16, 1),\n // (7,36): error CS0027: Keyword 'this' is not available in the current context\n // int prop { get { return 1; } set { this.a = 1;} } // 4\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\").WithLocation(7, 36),\n // (10,5): error CS0027: Keyword 'this' is not available in the current context\n // this.goo(); // 5\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\").WithLocation(10, 5),\n // (11,5): error CS0027: Keyword 'this' is not available in the current context\n // this.a = // 6\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\").WithLocation(11, 5),\n // (12,9): error CS0027: Keyword 'this' is not available in the current context\n // this.b; // 7\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\").WithLocation(12, 9),\n // (13,16): error CS0027: Keyword 'this' is not available in the current context\n // object c = this; // 8\n Diagnostic(ErrorCode.ERR_ThisInBadContext, \"this\").WithLocation(13, 16)\n );\n }\n\n [Fact]\n public void CS0029ERR_NoImplicitConv01()\n {\n var text = @\"\nnamespace ConsoleApplication3\n{\n class MyClass\n {\n\n int err1 = 1; \n\n public string Fun()\n {\n return err1;\n }\n\n public static void Main()\n {\n MyClass c = new MyClass();\n }\n }\n}\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text,\n new ErrorDescription[] { new ErrorDescription { Code = (int)ErrorCode.ERR_NoImplicitConv, Line = 11, Column = 20 } });\n }\n\n [Fact]\n public void CS0029ERR_NoImplicitConv02()\n {\n var source = \"enum E { A = new[] { 1, 2, 3 } }\";\n CreateCompilation(source).VerifyDiagnostics(\n // (1,14): error CS0029: Cannot implicitly convert type 'int[]' to 'int'\n // enum E { A = new[] { 1, 2, 3 } }\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"new[] { 1, 2, 3 }\").WithArguments(\"int[]\", \"int\").WithLocation(1, 14));\n }\n\n [Fact]\n public void CS0029ERR_NoImplicitConv03()\n {\n var source =\n@\"class C\n{\n static void M()\n {\n const C d = F();\n }\n static D F()\n {\n return null;\n }\n}\nclass D\n{\n}\n\";\n CreateCompilation(source).VerifyDiagnostics(\n // (5,21): error CS0029: Cannot implicitly convert type 'D' to 'C'\n // const C d = F();\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"F()\").WithArguments(\"D\", \"C\").WithLocation(5, 21));\n }\n\n [WorkItem(541719, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541719\")]\n [Fact]\n public void CS0029ERR_NoImplicitConv04()\n {\n var text =\n@\"class C1\n{\n public static void Main()\n {\n bool m = true;\n int[] arr = new int[m]; // Invalid\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,29): error CS0029: Cannot implicitly convert type 'bool' to 'int'\n // int[] arr = new int[m]; // Invalid\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"m\").WithArguments(\"bool\", \"int\").WithLocation(6, 29));\n }\n\n [Fact, WorkItem(40405, \"https://github.com/dotnet/roslyn/issues/40405\")]\n public void ThrowExpression_ImplicitVoidConversion_Return()\n {\n string text = @\"\nclass C\n{\n void M1()\n {\n return true ? throw null : M2();\n }\n\n void M2() { }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,23): error CS0029: Cannot implicitly convert type '' to 'void'\n // return true ? throw null : M2();\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"throw null\").WithArguments(\"\", \"void\").WithLocation(6, 23));\n }\n\n [Fact, WorkItem(40405, \"https://github.com/dotnet/roslyn/issues/40405\")]\n public void ThrowExpression_ImplicitVoidConversion_Assignment()\n {\n string text = @\"\nclass C\n{\n void M1()\n {\n object obj = true ? throw null : M2();\n }\n\n void M2() { }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,29): error CS0029: Cannot implicitly convert type '' to 'void'\n // object obj = true ? throw null : M2();\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"throw null\").WithArguments(\"\", \"void\").WithLocation(6, 29));\n }\n\n [Fact, WorkItem(40405, \"https://github.com/dotnet/roslyn/issues/40405\")]\n public void IntLiteral_ImplicitVoidConversion_Assignment()\n {\n string text = @\"\nclass C\n{\n void M1()\n {\n var obj = true ? 0 : M2();\n }\n\n void M2() { }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,19): error CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'int' and 'void'\n // var obj = true ? 0 : M2();\n Diagnostic(ErrorCode.ERR_InvalidQM, \"true ? 0 : M2()\").WithArguments(\"int\", \"void\").WithLocation(6, 19)\n );\n }\n\n [Fact, WorkItem(40405, \"https://github.com/dotnet/roslyn/issues/40405\")]\n public void VoidCall_ImplicitVoidConversion_Assignment()\n {\n string text = @\"\nclass C\n{\n void M1()\n {\n object obj = true ? M2() : M2();\n }\n\n void M2() { }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,22): error CS0029: Cannot implicitly convert type 'void' to 'object'\n // object obj = true ? M2() : M2();\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"true ? M2() : M2()\").WithArguments(\"void\", \"object\").WithLocation(6, 22));\n }\n\n [Fact, WorkItem(40405, \"https://github.com/dotnet/roslyn/issues/40405\")]\n public void VoidCall_ImplicitVoidConversion_DiscardAssignment()\n {\n string text = @\"\nclass C\n{\n void M1()\n {\n _ = true ? M2() : M2();\n }\n\n void M2() { }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,9): error CS8209: A value of type 'void' may not be assigned.\n // _ = true ? M2() : M2();\n Diagnostic(ErrorCode.ERR_VoidAssignment, \"_\").WithLocation(6, 9));\n }\n\n [Fact, WorkItem(40405, \"https://github.com/dotnet/roslyn/issues/40405\")]\n public void VoidCall_Assignment()\n {\n string text = @\"\nclass C\n{\n void M1()\n {\n object obj = M2();\n }\n\n void M2() { }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,22): error CS0029: Cannot implicitly convert type 'void' to 'object'\n // object obj = M2();\n Diagnostic(ErrorCode.ERR_NoImplicitConv, \"M2()\").WithArguments(\"void\", \"object\").WithLocation(6, 22));\n }\n\n [Fact, WorkItem(40405, \"https://github.com/dotnet/roslyn/issues/40405\")]\n public void VoidCall_DiscardAssignment()\n {\n string text = @\"\nclass C\n{\n void M1()\n {\n _ = M2();\n }\n\n void M2() { }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,9): error CS8209: A value of type 'void' may not be assigned.\n // _ = M2();\n Diagnostic(ErrorCode.ERR_VoidAssignment, \"_\").WithLocation(6, 9));\n }\n\n [Fact, WorkItem(40405, \"https://github.com/dotnet/roslyn/issues/40405\")]\n public void VoidCall_ImplicitVoidConversion_Return()\n {\n string text = @\"\nclass C\n{\n void M1()\n {\n return true ? M2() : M2();\n }\n\n void M2() { }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (6,9): error CS0127: Since 'C.M1()' returns void, a return keyword must not be followed by an object expression\n // return true ? M2() : M2();\n Diagnostic(ErrorCode.ERR_RetNoObjectRequired, \"return\").WithArguments(\"C.M1()\").WithLocation(6, 9));\n }\n\n [Fact]\n public void CS0030ERR_NoExplicitConv()\n {\n var text = @\"\nnamespace x\n{\n public class iii\n {\n public static iii operator ++(iii aa)\n {\n return (iii)0; // CS0030\n }\n }\n}\";\n CreateCompilation(text).VerifyDiagnostics(\n // (8,20): error CS0030: Cannot convert type 'int' to 'x.iii'\n // return (iii)0; // CS0030\n Diagnostic(ErrorCode.ERR_NoExplicitConv, \"(iii)0\").WithArguments(\"int\", \"x.iii\"));\n }\n\n [WorkItem(528539, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528539\")]\n [WorkItem(1119609, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1119609\")]\n [WorkItem(920, \"http://github.com/dotnet/roslyn/issues/920\")]\n [Fact]\n public void CS0030ERR_NoExplicitConv02()\n {\n const string text = @\"\npublic class C\n{\n public static void Main()\n {\n decimal x = (decimal)double.PositiveInfinity;\n }\n}\";\n var diagnostics = CreateCompilation(text).GetDiagnostics();\n\n var savedCurrentCulture = Thread.CurrentThread.CurrentCulture;\n var savedCurrentUICulture = Thread.CurrentThread.CurrentUICulture;\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;\n\n try\n {\n diagnostics.Verify(\n // (6,21): error CS0031: Constant value 'Infinity' cannot be converted to a 'decimal'\n // decimal x = (decimal)double.PositiveInfinity;\n Diagnostic(ErrorCode.ERR_ConstOutOfRange, \"(decimal)double.PositiveInfinity\").WithArguments(\"Infinity\", \"decimal\"),\n // (6,17): warning CS0219: The variable 'x' is assigned but its value is never used\n // decimal x = (decimal)double.PositiveInfinity;\n Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, \"x\").WithArguments(\"x\"));\n }\n finally\n {\n Thread.CurrentThread.CurrentCulture = savedCurrentCulture;\n Thread.CurrentThread.CurrentUICulture = savedCurrentUICulture;\n }\n }\n\n [Fact]\n public void CS0030ERR_NoExplicitConv_Foreach()\n {\n var text = @\"\npublic class Test\n{\n static void Main(string[] args)\n {\n int[][] arr = new int[][] { new int[] { 1, 2 }, new int[] { 4, 5, 6 } };\n foreach (int outer in arr) { } // invalid\n }\n}\";\n CreateCompilation(text).VerifyDiagnostics(Diagnostic(ErrorCode.ERR_NoExplicitConv, \"foreach\").WithArguments(\"int[]\", \"int\"));\n }\n\n [Fact]\n public void CS0031ERR_ConstOutOfRange01()\n {\n var text =\n@\"public class a\n{\n int num = (int)2147483648M; //CS0031\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (3,15): error CS0031: Constant value '2147483648M' cannot be converted to a 'int'\n // int num = (int)2147483648M; //CS0031\n Diagnostic(ErrorCode.ERR_ConstOutOfRange, \"(int)2147483648M\").WithArguments(\"2147483648M\", \"int\"),\n // (3,9): warning CS0414: The field 'a.num' is assigned but its value is never used\n // int num = (int)2147483648M; //CS0031\n Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, \"num\").WithArguments(\"a.num\"));\n }\n\n [WorkItem(528539, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528539\")]\n [Fact]\n public void CS0031ERR_ConstOutOfRange02()\n {\n var text = @\"\nenum E : ushort\n{\n A = 10,\n B = -1 // CS0031\n}\nenum F : sbyte\n{\n A = 0x7f,\n B = 0xf0, // CS0031\n C,\n D = (A + 1) - 2,\n E = (A + 1), // CS0031\n}\nclass A\n{\n byte bt = 256;\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(\n // (5,9): error CS0031: Constant value '-1' cannot be converted to a 'ushort'\n // B = -1 // CS0031\n Diagnostic(ErrorCode.ERR_ConstOutOfRange, \"-1\").WithArguments(\"-1\", \"ushort\").WithLocation(5, 9),\n // (10,9): error CS0031: Constant value '240' cannot be converted to a 'sbyte'\n // B = 0xf0, // CS0031\n Diagnostic(ErrorCode.ERR_ConstOutOfRange, \"0xf0\").WithArguments(\"240\", \"sbyte\").WithLocation(10, 9),\n // (13,10): error CS0031: Constant value '128' cannot be converted to a 'sbyte'\n // E = (A + 1), // CS0031\n Diagnostic(ErrorCode.ERR_ConstOutOfRange, \"A + 1\").WithArguments(\"128\", \"sbyte\").WithLocation(13, 10),\n // (17,15): error CS0031: Constant value '256' cannot be converted to a 'byte'\n // byte bt = 256;\n Diagnostic(ErrorCode.ERR_ConstOutOfRange, \"256\").WithArguments(\"256\", \"byte\").WithLocation(17, 15),\n // (17,10): warning CS0414: The field 'A.bt' is assigned but its value is never used\n // byte bt = 256;\n Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, \"bt\").WithArguments(\"A.bt\").WithLocation(17, 10));\n }\n\n [Fact]\n public void CS0221ERR_ConstOutOfRangeChecked04()\n {\n // Confirm that we truncate the constant value before performing the range check\n var template =\n@\"public class C\n{\n void M()\n {\n System.Console.WriteLine((System.Int32)(System.Int32.MinValue - 0.9));\n System.Console.WriteLine((System.Int32)(System.Int32.MinValue - 1.0)); //CS0221\n System.Console.WriteLine((System.Int32)(System.Int32.MaxValue + 0.9));\n System.Console.WriteLine((System.Int32)(System.Int32.MaxValue + 1.0)); //CS0221\n }\n}\n\";\n var integralTypes = new Type[]\n {\n typeof(char),\n typeof(sbyte),\n typeof(byte),\n typeof(short),\n typeof(ushort),\n typeof(int),\n typeof(uint),\n };\n\n foreach (Type t in integralTypes)\n {\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(template.Replace(\"System.Int32\", t.ToString()),\n new ErrorDescription { Code = (int)ErrorCode.ERR_ConstOutOfRangeChecked, Line = 6, Column = 34 },\n new ErrorDescription { Code = (int)ErrorCode.ERR_ConstOutOfRangeChecked, Line = 8, Column = 34 });\n }\n }\n\n // Note that the errors for Int64 and UInt64 are not\n // exactly the same as for Int32, etc. above, but the\n // differences match the native compiler.\n [WorkItem(528715, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528715\")]\n [Fact]\n public void CS0221ERR_ConstOutOfRangeChecked05()\n {\n // Confirm that we truncate the constant value before performing the range check\n var text1 =\n@\"public class C\n{\n void M()\n {\n System.Console.WriteLine((System.Int64)(System.Int64.MinValue - 0.9));\n System.Console.WriteLine((System.Int64)(System.Int64.MinValue - 1.0));\n System.Console.WriteLine((System.Int64)(System.Int64.MaxValue + 0.9)); //CS0221\n System.Console.WriteLine((System.Int64)(System.Int64.MaxValue + 1.0)); //CS0221\n }\n}\n\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text1,\n new ErrorDescription { Code = (int)ErrorCode.ERR_ConstOutOfRangeChecked, Line = 7, Column = 34 },\n new ErrorDescription { Code = (int)ErrorCode.ERR_ConstOutOfRangeChecked, Line = 8, Column = 34 });\n\n var text2 =\n@\"public class C\n{\n void M()\n {\n System.Console.WriteLine((System.UInt64)(System.UInt64.MinValue - 0.9));\n System.Console.WriteLine((System.UInt64)(System.UInt64.MinValue - 1.0)); //CS0221\n System.Console.WriteLine((System.UInt64)(System.UInt64.MaxValue + 0.9)); //CS0221\n System.Console.WriteLine((System.UInt64)(System.UInt64.MaxValue + 1.0)); //CS0221\n }\n}\n\";\n DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text2,\n new ErrorDescription { Code = (int)ErrorCode.ERR_ConstOutOfRangeChecked, Line = 6, Column = 34 },\n new ErrorDescription { Code = (int)ErrorCode.ERR_ConstOutOfRangeChecked, Line = 7, Column = 34 },\n new ErrorDescription { Code = (int)ErrorCode.ERR_ConstOutOfRangeChecked, Line = 8, Column = 34 });\n\n var text3 =\n@\"class C\n{\n static void Main()\n {\n System.Console.WriteLine(long.MinValue);\n System.Console.WriteLine((long)(double)long.MinValue);\n }\n}\";\n CreateCompilation(text3).VerifyDiagnostics();\n }\n\n [Fact]\n public void CS0034ERR_AmbigBinaryOps()\n {\n #region \"Source\"\n var text = @\"\npublic class A\n{\n // allows for the conversion of A object to int\n public static implicit operator int(A s)\n {\n return 0;\n }\n\n public static implicit operator string(A i)\n {\n return null;\n }\n}\n\npublic class B\n{\n public static implicit operator int(B s)\n // one way to resolve this CS0034 is to make one conversion explicit\n // public static explicit operator int (B s)\n {\n return 0;\n }\n\n public static implicit operator string(B i)\n {\n return null;\n }\n\n public static implicit operator B(string i)\n {\n return null;\n }\n\n public static implicit operator B(int i)\n {\n return null;\n }\n}\n\npublic class C\n{\n public static void Main()\n {\n A a = new A();\n B b = new B();\n b = b + a; // CS0034\n // another way to resolve this CS0034 is to make a cast\n // b = b + (int)a;\n }\n}\n\";\n #endregion\n\n CreateCompilation(text).VerifyDiagnostics(\n // (47,13): error CS0034: Operator '+' is ambiguous on operands of type 'B' and 'A'\n // b = b + a; // CS0034\n Diagnostic(ErrorCode.ERR_AmbigBinaryOps, \"b + a\").WithArguments(\"+\", \"B\", \"A\"));\n }\n\n [Fact]\n public void CS0035ERR_AmbigUnaryOp_RoslynCS0023()\n {\n var text = @\"\nclass MyClass\n{\n private int i;\n\n public MyClass(int i)\n {\n this.i = i;\n }\n\n public static implicit operator double(MyClass x)\n {\n return (double)x.i;\n }\n\n public static implicit operator decimal(MyClass x)\n {\n return (decimal)x.i;\n }\n}\n\nclass MyClass2\n{\n static void Main()\n {\n MyClass x = new MyClass(7);\n object o = -x; // CS0035\n }\n}\";\n CreateCompilation(text).VerifyDiagnostics(\n // (27,20): error CS0035: Operator '-' is ambiguous on an operand of type 'MyClass'\n // object o = -x; // CS0035\n Diagnostic(ErrorCode.ERR_AmbigUnaryOp, \"-x\").WithArguments(\"-\", \"MyClass\"));\n }\n\n [Fact]\n public void CS0037ERR_ValueCantBeNull01()\n {\n var source =\n@\"enum E { }\nstruct S { }\nclass C\n{\n static void M()\n {\n int i;\n i = null;\n i = (int)null;\n E e;\n e = null;\n e = (E)null;\n S s;\n s = null;\n s = (S)null;\n X x;\n x = null;\n x = (X)null;\n }\n}\";\n CreateCompilation(source).VerifyDiagnostics(\n // (8,13): error CS0037: Cannot convert null to 'int' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"null\").WithArguments(\"int\").WithLocation(8, 13),\n // (9,13): error CS0037: Cannot convert null to 'int' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"(int)null\").WithArguments(\"int\").WithLocation(9, 13),\n // (11,13): error CS0037: Cannot convert null to 'E' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"null\").WithArguments(\"E\").WithLocation(11, 13),\n // (12,13): error CS0037: Cannot convert null to 'E' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"(E)null\").WithArguments(\"E\").WithLocation(12, 13),\n // (14,13): error CS0037: Cannot convert null to 'S' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"null\").WithArguments(\"S\").WithLocation(14, 13),\n // (15,13): error CS0037: Cannot convert null to 'S' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"(S)null\").WithArguments(\"S\").WithLocation(15, 13),\n // (16,9): error CS0246: The type or namespace name 'X' could not be found (are you missing a using directive or an assembly reference?)\n Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, \"X\").WithArguments(\"X\").WithLocation(16, 9),\n // (18,14): error CS0246: The type or namespace name 'X' could not be found (are you missing a using directive or an assembly reference?)\n Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, \"X\").WithArguments(\"X\").WithLocation(18, 14));\n }\n\n [Fact]\n public void CS0037ERR_ValueCantBeNull02()\n {\n var source =\n@\"interface I { }\nclass A { }\nclass B\n where T2 : class\n where T3 : struct\n where T4 : new()\n where T5 : I\n where T6 : A\n where T7 : T1\n{\n static void M(object o)\n {\n o = (T1)null;\n o = (T2)null;\n o = (T3)null;\n o = (T4)null;\n o = (T5)null;\n o = (T6)null;\n o = (T7)null;\n }\n}\";\n CreateCompilation(source).VerifyDiagnostics(\n // (13,17): error CS0037: Cannot convert null to 'T1' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"(T1)null\").WithArguments(\"T1\").WithLocation(13, 13),\n // (15,17): error CS0037: Cannot convert null to 'T3' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"(T3)null\").WithArguments(\"T3\").WithLocation(15, 13),\n // (16,17): error CS0037: Cannot convert null to 'T4' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"(T4)null\").WithArguments(\"T4\").WithLocation(16, 13),\n // (17,17): error CS0037: Cannot convert null to 'T5' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"(T5)null\").WithArguments(\"T5\").WithLocation(17, 13),\n // (19,17): error CS0037: Cannot convert null to 'T7' because it is a non-nullable value type\n Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"(T7)null\").WithArguments(\"T7\").WithLocation(19, 13));\n }\n\n [WorkItem(539589, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539589\")]\n [Fact]\n public void CS0037ERR_ValueCantBeNull03()\n {\n var text = @\"\nclass Program\n{\n enum MyEnum\n {\n Zero = 0,\n One = 1\n }\n\n static int Main()\n {\n return Goo((MyEnum)null);\n }\n\n static int Goo(MyEnum x)\n {\n return 1;\n }\n}\n\";\n CreateCompilation(text).VerifyDiagnostics(Diagnostic(ErrorCode.ERR_ValueCantBeNull, \"(MyEnum)null\").WithArguments(\"Program.MyEnum\").WithLocation(12, 20));\n }\n\n [Fact(), WorkItem(528875, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528875\")]\n public void CS0038ERR_WrongNestedThis()\n {\n var text = @\"\nclass OuterClass\n{\n public int count;\n // try the following line instead\n // public static int count;\n\n class InnerClass\n {\n void func()\n {\n // or, create an instance\n // OuterClass class_inst = new OuterClass();\n // int count2 = class_inst.count;\n int count2 = count; // CS0038\n }\n }\n\n public static void Main()\n {\n }\n}\";\n // Triage decided not to implement the more specific error (WrongNestedThis) and stick with ObjectRequired.\n var comp = CreateCompilation(text, options: TestOptions.ReleaseDll.WithSpecificDiagnosticOptions(new Dictionary