diff --git a/Roslyn.sln b/Roslyn.sln index b5d318bcc206d..61c8682f2503f 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -1473,7 +1473,7 @@ Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5 - src\Compilers\CSharp\CommandLine\CscCommandLine.projitems*{0161e25c-918a-4dc8-9648-30fdcc8e31e9}*SharedItemsImports = 5 + src\Compilers\CSharp\csc\CscCommandLine.projitems*{0161e25c-918a-4dc8-9648-30fdcc8e31e9}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{0be66736-cdaa-4989-88b1-b3f46ebdca4a}*SharedItemsImports = 5 src\Analyzers\Core\CodeFixes\CodeFixes.projitems*{1b6c4a1a-413b-41fb-9f85-5c09118e541b}*SharedItemsImports = 13 src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5 @@ -1495,7 +1495,7 @@ Global src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5 src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.projitems*{438db8af-f3f0-4ed9-80b5-13fddd5b8787}*SharedItemsImports = 13 - src\Compilers\CSharp\CommandLine\CscCommandLine.projitems*{4b45ca0c-03a0-400f-b454-3d4bcb16af38}*SharedItemsImports = 5 + src\Compilers\CSharp\csc\CscCommandLine.projitems*{4b45ca0c-03a0-400f-b454-3d4bcb16af38}*SharedItemsImports = 5 src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.projitems*{5018d049-5870-465a-889b-c742ce1e31cb}*SharedItemsImports = 5 src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{54e08bf5-f819-404f-a18d-0ab9ea81ea04}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.projitems*{57ca988d-f010-4bf2-9a2e-07d6dcd2ff2c}*SharedItemsImports = 5 @@ -1513,8 +1513,8 @@ Global src\Analyzers\Core\Analyzers\Analyzers.projitems*{76e96966-4780-4040-8197-bde2879516f4}*SharedItemsImports = 13 src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{7b7f4153-ae93-4908-b8f0-430871589f83}*SharedItemsImports = 13 src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.projitems*{94faf461-2e74-4dbb-9813-6b2cde6f1880}*SharedItemsImports = 13 - src\Compilers\Server\CommandLine\VBCSCompilerCommandLine.projitems*{9508f118-f62e-4c16-a6f4-7c3b56e166ad}*SharedItemsImports = 5 - src\Compilers\VisualBasic\CommandLine\VbcCommandLine.projitems*{975cd834-45f4-4ea0-a395-cb60dbd0e214}*SharedItemsImports = 5 + src\Compilers\Server\VBCSCompiler\VBCSCompilerCommandLine.projitems*{9508f118-f62e-4c16-a6f4-7c3b56e166ad}*SharedItemsImports = 5 + src\Compilers\VisualBasic\vbc\VbcCommandLine.projitems*{975cd834-45f4-4ea0-a395-cb60dbd0e214}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.projitems*{99f594b1-3916-471d-a761-a6731fc50e9a}*SharedItemsImports = 13 src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{9f9ccc78-7487-4127-9d46-db23e501f001}*SharedItemsImports = 13 src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{a07abcf5-bc43-4ee9-8fd8-b2d77fd54d73}*SharedItemsImports = 5 @@ -1535,9 +1535,9 @@ Global src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{d0bc9be7-24f6-40ca-8dc6-fcb93bd44b34}*SharedItemsImports = 13 src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems*{d73adf7d-2c1c-42ae-b2ab-edc9497e4b71}*SharedItemsImports = 13 src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{da973826-c985-4128-9948-0b445e638bdb}*SharedItemsImports = 13 - src\Compilers\Server\CommandLine\VBCSCompilerCommandLine.projitems*{dc8c78cc-b6fe-47bf-93b1-b65a1c67c08d}*SharedItemsImports = 5 + src\Compilers\Server\VBCSCompiler\VBCSCompilerCommandLine.projitems*{dc8c78cc-b6fe-47bf-93b1-b65a1c67c08d}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{e512c6c1-f085-4ad7-b0d9-e8f1a0a2a510}*SharedItemsImports = 5 - src\Compilers\VisualBasic\CommandLine\VbcCommandLine.projitems*{e58ee9d7-1239-4961-a0c1-f9ec3952c4c1}*SharedItemsImports = 5 + src\Compilers\VisualBasic\vbc\VbcCommandLine.projitems*{e58ee9d7-1239-4961-a0c1-f9ec3952c4c1}*SharedItemsImports = 5 src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{e8f0baa5-7327-43d1-9a51-644e81ae55f1}*SharedItemsImports = 13 src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{e919dd77-34f8-4f57-8058-4d3ff4c2b241}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{e9dbfa41-7a9c-49be-bd36-fd71b31aa9fe}*SharedItemsImports = 13 diff --git a/azure-pipelines-integration-dartlab.yml b/azure-pipelines-integration-dartlab.yml index 6e1fe0eb0da37..4db72a49e343c 100644 --- a/azure-pipelines-integration-dartlab.yml +++ b/azure-pipelines-integration-dartlab.yml @@ -20,7 +20,7 @@ resources: endpoint: dnceng/internal dotnet-roslyn type: git name: internal/dotnet-roslyn - ref: $(Build.SourceBranchName) + ref: $(Build.SourceBranch) trigger: - main diff --git a/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md b/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md index 57b35de0133bc..744e788b4c100 100644 --- a/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md +++ b/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md @@ -1,5 +1,16 @@ # This document lists known breaking changes in Roslyn after .NET 6 all the way to .NET 7. +## Required spaces in #line span directives + +***Introduced in .NET SDK 6.0.400, Visual Studio 2022 version 17.3.*** + +When the `#line` span directive was introduced in C# 10, it required no particular spacing. +For example, this would be valid: `#line(1,2)-(3,4)5"file.cs"`. + +In Visual Studio 17.3, the compiler requires spaces before the first parenthesis, the character +offset, and the file name. +So the above example fails to parse unless spaces are added: `#line (1,2)-(3,4) 5 "file.cs"`. + ## Checked operators on System.IntPtr and System.UIntPtr ***Introduced in .NET SDK 7.0.100, Visual Studio 2022 version 17.3.*** diff --git a/docs/contributing/Building, Debugging, and Testing on Windows.md b/docs/contributing/Building, Debugging, and Testing on Windows.md index 60561b7fb3b44..42fec1cfa0558 100644 --- a/docs/contributing/Building, Debugging, and Testing on Windows.md +++ b/docs/contributing/Building, Debugging, and Testing on Windows.md @@ -54,6 +54,22 @@ Tests can be run and debugged from the Test Explorer window. For best performanc 2. Use the Search box of Test Explorer to narrow the scope of visible tests to the feature(s) you are working on 3. When you are not actively running tests, set the search query to `__NonExistent__` to hide all tests from the UI +#### Testing in Linux using WSL + +Tests can be run and debugged under WSL. This requires a bit of setup the first time. After that, it is as easy as selecting WSL as the active environment in Test Explorer. + +1. Install WSL by running `wsl --install` ([details](https://docs.microsoft.com/en-us/windows/wsl/setup/environment#get-started)) +2. In the VS installer, install ".NET Debugging with WSL" as an individual component +3. In Test Explorer, go into "Configure Remote Test Environments" (under the gear icon) and uncomment the wsl/Ubuntu environment: +![image](https://user-images.githubusercontent.com/12466233/169365278-485573de-0b14-466e-a96d-b1de5e67e891.png) +![image](https://user-images.githubusercontent.com/12466233/169365165-a2bfc6bc-96ba-45fa-8705-eb8e7997df62.png) +4. Select that test environment from Test Explorer drop-down: +![image](https://user-images.githubusercontent.com/12466233/169365451-681fcbb2-0b21-46f6-bc30-de58ce01bfdc.png) +5. Run a test from Test Explorer test list. This will prompt you to install some dotnet bits into the WSL environment the first time. +6. Debug a test. This will prompt you to install some remote debugging bits into the WSL environment the first time. + +[More details](https://docs.microsoft.com/en-us/visualstudio/debugger/debug-dotnet-core-in-wsl-2) + ### WPF Test Runner To debug through tests, you can right click the test project that contains your @@ -66,6 +82,13 @@ give it a try. ## Trying Your Changes in Visual Studio +### Deploying with command-line (recommended method) + +You can build and deploy with the following command: +`.\Build.cmd -Configuration Release -deployExtensions -launch`. + +Then you can launch the `RoslynDev` hive with `devenv /rootSuffix RoslynDev`. + ### Deploying with F5 The Rosyln solution is designed to support easy debugging via F5. Several of our @@ -140,13 +163,7 @@ your csproj. As shown below, you'll want to (1) add a nuget source pointing to y ![image](https://user-images.githubusercontent.com/12466233/81206129-7fbe8680-8f80-11ea-9438-acc0481a3585.png) - -### Deploying with command-line - -You can build and deploy with the following command: -`.\Build.cmd -Configuration Release -deployExtensions -launch`. - -Then you can launch the `RoslynDev` hive with `devenv /rootSuffix RoslynDev`. +## Various other tips ### Referencing bootstrap compiler @@ -185,18 +202,7 @@ Run `build.cmd -testIOperation` which sets the `ROSLYN_TEST_IOPERATION` environm For running those tests in an IDE, the easiest is to find the `//#define ROSLYN_TEST_IOPERATION` directive and uncomment it. See more details in the [IOperation test hook](https://github.com/dotnet/roslyn/blob/main/docs/compilers/IOperation%20Test%20Hook.md) doc. -### Running the PublicAPI fixer - -1. Install `dotnet-format` as a global tool. It does ship as part of the SDK, but a separate version can be installed as a global tool and invoked with `dotnet-format {options}`. -`C:\Source\roslyn> dotnet tool install -g dotnet-format --version "6.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json` -2. Restore and build `Compilers.sln`. This is necessary to ensure the source generator project is built and we can load the generator assembly when running `dotnet-format`. -`C:\Source\roslyn> .\restore.cmd` -`C:\Source\roslyn> .\build.cmd` -3. Invoke the `dotnet-format` global tool. Running only the analyzers subcommand and fixing only the "missing Public API signature" diagnostic. We must also pass the `--include-generated` flag to include source generated documents in the analysis. -`C:\Source\roslyn> cd ..` -`C:\Source> dotnet-format analyzers .\roslyn\Compilers.sln --diagnostics=RS0016 --no-restore --include-generated -v diag` - -## Replicating Failures in the Used Assemblies leg +### Replicating Failures in the Used Assemblies leg In order to replicate test failures in that leg, there are a few options: @@ -210,6 +216,18 @@ When a test failure is isolated, please add a _dedicated_ test for this (ie. fai Preferrably, don't replicate the entire original test, just enough to hit the bug to ensure that it's protected against regressions. Before pushing a relevant fix to CI, you can validate locally using the `-testUsedAssemblies` command-line option for `build.cmd`. For example: `build.cmd -testCoreClr -testCompilerOnly -testUsedAssemblies`. +### Running the PublicAPI fixer + +1. Install `dotnet-format` as a global tool. It does ship as part of the SDK, but a separate version can be installed as a global tool and invoked with `dotnet-format {options}`. +`C:\Source\roslyn> dotnet tool install -g dotnet-format --version "6.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json` +2. Restore and build `Compilers.sln`. This is necessary to ensure the source generator project is built and we can load the generator assembly when running `dotnet-format`. +`C:\Source\roslyn> .\restore.cmd` +`C:\Source\roslyn> .\build.cmd` +3. Invoke the `dotnet-format` global tool. Running only the analyzers subcommand and fixing only the "missing Public API signature" diagnostic. We must also pass the `--include-generated` flag to include source generated documents in the analysis. +`C:\Source\roslyn> cd ..` +`C:\Source> dotnet-format analyzers .\roslyn\Compilers.sln --diagnostics=RS0016 --no-restore --include-generated -v diag` + + ## Contributing Please see [Contributing Code](https://github.com/dotnet/roslyn/blob/main/CONTRIBUTING.md) for details on contributing changes back to the code. diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs index ac1dfdfb3ec48..2e70a14ceb381 100644 --- a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs +++ b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs @@ -1754,12 +1754,11 @@ public bool HasAnyNullabilityImplicitConversion(TypeWithAnnotations source, Type ClassifyImplicitConversionFromType(source.Type, destination.Type, ref discardedUseSiteInfo).Kind != ConversionKind.NoConversion; } - public static bool HasIdentityConversionToAny(T type, ArrayBuilder targetTypes) - where T : TypeSymbol + private static bool HasIdentityConversionToAny(NamedTypeSymbol type, ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> targetTypes) { foreach (var targetType in targetTypes) { - if (HasIdentityConversionInternal(type, targetType, includeNullability: false)) + if (HasIdentityConversionInternal(type, targetType.ParticipatingType, includeNullability: false)) { return true; } diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedConversions.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedConversions.cs index 6c28f576c6119..607f3eaedd31a 100644 --- a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedConversions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedConversions.cs @@ -2,20 +2,19 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.Diagnostics; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; using System.Collections.Generic; +using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.CSharp { internal partial class ConversionsBase { - public static void AddTypesParticipatingInUserDefinedConversion(ArrayBuilder result, TypeSymbol type, bool includeBaseTypes, ref CompoundUseSiteInfo useSiteInfo) + public static void AddTypesParticipatingInUserDefinedConversion(ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol? ConstrainedToTypeOpt)> result, TypeSymbol type, bool includeBaseTypes, ref CompoundUseSiteInfo useSiteInfo) { // CONSIDER: These sets are usually small; if they are large then this is an O(n^2) // CONSIDER: algorithm. We could use a hash table instead to build up the set. @@ -52,23 +51,18 @@ public static void AddTypesParticipatingInUserDefinedConversion(ArrayBuilder interfaces = includeBaseTypes ? + typeParameter.AllEffectiveInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo) : + typeParameter.EffectiveInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo); + + foreach (NamedTypeSymbol iface in interfaces) { - case SpecialType.System_ValueType: - case SpecialType.System_Enum: - case SpecialType.System_Array: - case SpecialType.System_Object: - if (!excludeExisting || !HasIdentityConversionToAny(typeParameter, result)) - { - // Add the type parameter to the set as well. This will be treated equivalent to adding its - // effective interfaces to the set. We are not doing that here because we still need to know - // the originating type parameter as "constrained to" type. - result.Add(typeParameter); - } - break; + if (!excludeExisting || !HasIdentityConversionToAny(iface, result)) + { + result.Add((iface, typeParameter)); + } } } else @@ -76,13 +70,14 @@ public static void AddTypesParticipatingInUserDefinedConversion(ArrayBuilder result, bool excludeExisting, TypeSymbol type, bool includeBaseTypes, ref CompoundUseSiteInfo useSiteInfo) + static void addFromClassOrStruct(ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol? ConstrainedToTypeOpt)> result, bool excludeExisting, TypeSymbol type, bool includeBaseTypes, ref CompoundUseSiteInfo useSiteInfo) { if (type.IsClassType() || type.IsStructType()) { - if (!excludeExisting || !HasIdentityConversionToAny(type, result)) + var namedType = (NamedTypeSymbol)type; + if (!excludeExisting || !HasIdentityConversionToAny(namedType, result)) { - result.Add(type); + result.Add((namedType, null)); } } @@ -96,7 +91,7 @@ static void addFromClassOrStruct(ArrayBuilder result, bool excludeEx { if (!excludeExisting || !HasIdentityConversionToAny(t, result)) { - result.Add(t); + result.Add((t, null)); } t = t.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteInfo); diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedExplicitConversions.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedExplicitConversions.cs index 5aff3b2cda3d8..b296d8cf4ca7b 100644 --- a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedExplicitConversions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedExplicitConversions.cs @@ -33,7 +33,7 @@ private UserDefinedConversionResult AnalyzeExplicitUserDefinedConversions( // SPEC: Find the set of types D from which user-defined conversion operators // SPEC: will be considered... - var d = ArrayBuilder.GetInstance(); + var d = ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)>.GetInstance(); ComputeUserDefinedExplicitConversionTypeSet(source, target, d, ref useSiteInfo); // SPEC: Find the set of applicable user-defined and lifted conversion operators, U... @@ -71,7 +71,7 @@ private UserDefinedConversionResult AnalyzeExplicitUserDefinedConversions( return UserDefinedConversionResult.Valid(u, best.Value); } - private static void ComputeUserDefinedExplicitConversionTypeSet(TypeSymbol source, TypeSymbol target, ArrayBuilder d, ref CompoundUseSiteInfo useSiteInfo) + private static void ComputeUserDefinedExplicitConversionTypeSet(TypeSymbol source, TypeSymbol target, ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> d, ref CompoundUseSiteInfo useSiteInfo) { // Spec 6.4.5: User-defined explicit conversions // Find the set of types, D, from which user-defined conversion operators will be considered. @@ -87,7 +87,7 @@ private void ComputeApplicableUserDefinedExplicitConversionSet( TypeSymbol source, TypeSymbol target, bool isChecked, - ArrayBuilder d, + ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> d, ArrayBuilder u, ref CompoundUseSiteInfo useSiteInfo) { @@ -97,30 +97,29 @@ private void ComputeApplicableUserDefinedExplicitConversionSet( Debug.Assert(d != null); Debug.Assert(u != null); - HashSet lookedInInterfaces = null; + bool haveInterfaces = false; - foreach (TypeSymbol declaringType in d) + foreach ((NamedTypeSymbol declaringType, TypeParameterSymbol constrainedToTypeOpt) in d) { - if (declaringType is TypeParameterSymbol typeParameter) + if (declaringType.IsInterface) { - ImmutableArray interfaceTypes = typeParameter.AllEffectiveInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo); - - if (!interfaceTypes.IsEmpty) - { - lookedInInterfaces ??= new HashSet(Symbols.SymbolEqualityComparer.AllIgnoreOptions); // Equivalent to has identity conversion check - - foreach (var interfaceType in interfaceTypes) - { - if (lookedInInterfaces.Add(interfaceType)) - { - addCandidatesFromType(constrainedToTypeOpt: typeParameter, interfaceType, sourceExpression, source, target, isChecked: isChecked, u, ref useSiteInfo); - } - } - } + Debug.Assert(constrainedToTypeOpt is not null); + haveInterfaces = true; } else { - addCandidatesFromType(constrainedToTypeOpt: null, (NamedTypeSymbol)declaringType, sourceExpression, source, target, isChecked: isChecked, u, ref useSiteInfo); + addCandidatesFromType(constrainedToTypeOpt: null, declaringType, sourceExpression, source, target, isChecked: isChecked, u, ref useSiteInfo); + } + } + + if (u.Count == 0 && haveInterfaces) + { + foreach ((NamedTypeSymbol declaringType, TypeParameterSymbol constrainedToTypeOpt) in d) + { + if (declaringType.IsInterface) + { + addCandidatesFromType(constrainedToTypeOpt: constrainedToTypeOpt, declaringType, sourceExpression, source, target, isChecked: isChecked, u, ref useSiteInfo); + } } } diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedImplicitConversions.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedImplicitConversions.cs index 8d5d92b0044d4..acae729c7309c 100644 --- a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedImplicitConversions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/UserDefinedImplicitConversions.cs @@ -77,7 +77,7 @@ private UserDefinedConversionResult AnalyzeImplicitUserDefinedConversions( // A user-defined implicit conversion from an expression E to type T is processed as follows: // SPEC: Find the set of types D from which user-defined conversion operators... - var d = ArrayBuilder.GetInstance(); + var d = ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)>.GetInstance(); ComputeUserDefinedImplicitConversionTypeSet(source, target, d, ref useSiteInfo); // SPEC: Find the set of applicable user-defined and lifted conversion operators, U... @@ -115,7 +115,7 @@ private UserDefinedConversionResult AnalyzeImplicitUserDefinedConversions( return UserDefinedConversionResult.Valid(u, best.Value); } - private static void ComputeUserDefinedImplicitConversionTypeSet(TypeSymbol s, TypeSymbol t, ArrayBuilder d, ref CompoundUseSiteInfo useSiteInfo) + private static void ComputeUserDefinedImplicitConversionTypeSet(TypeSymbol s, TypeSymbol t, ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> d, ref CompoundUseSiteInfo useSiteInfo) { // Spec 6.4.4: User-defined implicit conversions // Find the set of types D from which user-defined conversion operators @@ -143,7 +143,7 @@ private void ComputeApplicableUserDefinedImplicitConversionSet( BoundExpression sourceExpression, TypeSymbol source, TypeSymbol target, - ArrayBuilder d, + ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> d, ArrayBuilder u, ref CompoundUseSiteInfo useSiteInfo, bool allowAnyTarget = false) @@ -245,30 +245,29 @@ private void ComputeApplicableUserDefinedImplicitConversionSet( return; } - HashSet lookedInInterfaces = null; + bool haveInterfaces = false; - foreach (TypeSymbol declaringType in d) + foreach ((NamedTypeSymbol declaringType, TypeParameterSymbol constrainedToTypeOpt) in d) { - if (declaringType is TypeParameterSymbol typeParameter) + if (declaringType.IsInterface) { - ImmutableArray interfaceTypes = typeParameter.AllEffectiveInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo); - - if (!interfaceTypes.IsEmpty) - { - lookedInInterfaces ??= new HashSet(Symbols.SymbolEqualityComparer.AllIgnoreOptions); // Equivalent to has identity conversion check - - foreach (var interfaceType in interfaceTypes) - { - if (lookedInInterfaces.Add(interfaceType)) - { - addCandidatesFromType(constrainedToTypeOpt: typeParameter, interfaceType, sourceExpression, source, target, u, ref useSiteInfo, allowAnyTarget); - } - } - } + Debug.Assert(constrainedToTypeOpt is not null); + haveInterfaces = true; } else { - addCandidatesFromType(constrainedToTypeOpt: null, (NamedTypeSymbol)declaringType, sourceExpression, source, target, u, ref useSiteInfo, allowAnyTarget); + addCandidatesFromType(constrainedToTypeOpt: null, declaringType, sourceExpression, source, target, u, ref useSiteInfo, allowAnyTarget); + } + } + + if (u.Count == 0 && haveInterfaces) + { + foreach ((NamedTypeSymbol declaringType, TypeParameterSymbol constrainedToTypeOpt) in d) + { + if (declaringType.IsInterface) + { + addCandidatesFromType(constrainedToTypeOpt: constrainedToTypeOpt, declaringType, sourceExpression, source, target, u, ref useSiteInfo, allowAnyTarget); + } } } @@ -944,7 +943,7 @@ protected UserDefinedConversionResult AnalyzeImplicitUserDefinedConversionForV6S // SPEC VIOLATION: We do the same to maintain compatibility with the native compiler. // (a) Compute the set of types D from which user-defined conversion operators should be considered by considering only the source type. - var d = ArrayBuilder.GetInstance(); + var d = ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)>.GetInstance(); ComputeUserDefinedImplicitConversionTypeSet(source, t: null, d: d, useSiteInfo: ref useSiteInfo); // (b) Instead of computing applicable user defined implicit conversions U from the source type to a specific target type, diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index 36f9795e5f956..4ce4f67cfeb7d 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -6670,9 +6670,6 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ inferred delegate type - - line span directive - auto default struct fields @@ -6682,6 +6679,9 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The #line directive end position must be greater than or equal to the start position + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + Comparison of function pointers might yield an unexpected result, since pointers to the same function may be distinct. @@ -6887,7 +6887,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Target runtime doesn't support static abstract members in interfaces. - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. The parameter of a unary operator must be the containing type, or its type parameter constrained to it. @@ -7124,4 +7124,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Unexpected keyword 'unchecked' + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index d5865961b3996..3934b176ce6a6 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -2071,6 +2071,7 @@ internal enum ErrorCode ERR_CannotBeConvertedToUTF8 = 9026, ERR_MisplacedUnchecked = 9027, + ERR_LineSpanDirectiveRequiresSpace = 9028, ERR_RequiredNameDisallowed = 9029, ERR_OverrideMustHaveRequired = 9030, @@ -2087,6 +2088,7 @@ internal enum ErrorCode ERR_UnsupportedCompilerFeature = 9041, WRN_ObsoleteMembersShouldNotBeRequired = 9042, ERR_RefReturningPropertiesCannotBeRequired = 9043, + ERR_ImplicitImplementationOfInaccessibleInterfaceMember = 9044, #endregion diff --git a/src/Compilers/CSharp/Portable/Errors/MessageID.cs b/src/Compilers/CSharp/Portable/Errors/MessageID.cs index ac133c4752460..c64cb4dc638d5 100644 --- a/src/Compilers/CSharp/Portable/Errors/MessageID.cs +++ b/src/Compilers/CSharp/Portable/Errors/MessageID.cs @@ -230,7 +230,7 @@ internal enum MessageID IDS_FeatureLambdaReturnType = MessageBase + 12804, IDS_AsyncMethodBuilderOverride = MessageBase + 12805, IDS_FeatureImplicitImplementationOfNonPublicMembers = MessageBase + 12806, - IDS_FeatureLineSpanDirective = MessageBase + 12807, + // IDS_FeatureLineSpanDirective = MessageBase + 12807, // feature no longer gated on LangVer IDS_FeatureImprovedInterpolatedStrings = MessageBase + 12808, IDS_FeatureFileScopedNamespace = MessageBase + 12809, IDS_FeatureParameterlessStructConstructors = MessageBase + 12810, @@ -396,7 +396,6 @@ internal static LanguageVersion RequiredVersion(this MessageID feature) case MessageID.IDS_AsyncMethodBuilderOverride: // semantic check case MessageID.IDS_FeatureConstantInterpolatedStrings: // semantic check case MessageID.IDS_FeatureImplicitImplementationOfNonPublicMembers: // semantic check - case MessageID.IDS_FeatureLineSpanDirective: case MessageID.IDS_FeatureFileScopedNamespace: // syntax check case MessageID.IDS_FeatureParameterlessStructConstructors: // semantic check case MessageID.IDS_FeatureStructFieldInitializers: // semantic check diff --git a/src/Compilers/CSharp/Portable/Parser/DirectiveParser.cs b/src/Compilers/CSharp/Portable/Parser/DirectiveParser.cs index 9440dd7b828b6..fb354c19960dc 100644 --- a/src/Compilers/CSharp/Portable/Parser/DirectiveParser.cs +++ b/src/Compilers/CSharp/Portable/Parser/DirectiveParser.cs @@ -407,13 +407,12 @@ private LineSpanDirectiveTriviaSyntax ParseLineSpanDirective(SyntaxToken hash, S { Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); - if (isActive) - { - lineKeyword = CheckFeatureAvailability(lineKeyword, MessageID.IDS_FeatureLineSpanDirective); - } - bool reportError = isActive; var start = ParseLineDirectivePosition(ref reportError, out int startLine, out int startCharacter); + if (noTriviaBetween(lineKeyword, start.GetFirstToken())) + { + start = this.AddError(start, ErrorCode.ERR_LineSpanDirectiveRequiresSpace); + } var minus = EatToken(SyntaxKind.MinusToken, reportError: reportError); if (minus.IsMissing) reportError = false; @@ -429,11 +428,28 @@ private LineSpanDirectiveTriviaSyntax ParseLineSpanDirective(SyntaxToken hash, S ParseLineDirectiveNumericLiteral(ref reportError, minValue: 1, maxValue: MaxCharacterValue, out _) : null; + if (noTriviaBetween(end.GetLastToken(), characterOffset)) + { + characterOffset = this.AddError(characterOffset, ErrorCode.ERR_LineSpanDirectiveRequiresSpace); + } + var file = EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_MissingPPFile, reportError: reportError); if (file.IsMissing) reportError = false; + if (noTriviaBetween(characterOffset ?? end.GetLastToken(), file)) + { + file = this.AddError(file, ErrorCode.ERR_LineSpanDirectiveRequiresSpace); + } + var endOfDirective = this.ParseEndOfDirective(ignoreErrors: !reportError); return SyntaxFactory.LineSpanDirectiveTrivia(hash, lineKeyword, start, minus, end, characterOffset, file, endOfDirective, isActive); + + static bool noTriviaBetween(SyntaxToken token1, SyntaxToken token2) + { + return token1 is { IsMissing: false } + && token2 is { IsMissing: false } + && LanguageParser.NoTriviaBetween(token1, token2); + } } private LineDirectivePositionSyntax ParseLineDirectivePosition(ref bool reportError, out int line, out int character) diff --git a/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs b/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs index 34562301c5d4c..69bd4192f5b0e 100644 --- a/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs +++ b/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs @@ -4596,7 +4596,7 @@ private void ParseParameterNullCheck( GetExpectedTokenError(kind, t1.Kind)); } - private static bool NoTriviaBetween(SyntaxToken token1, SyntaxToken token2) + internal static bool NoTriviaBetween(SyntaxToken token1, SyntaxToken token2) => token1.GetTrailingTriviaWidth() == 0 && token2.GetLeadingTriviaWidth() == 0; #nullable disable diff --git a/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs b/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs index 468a4eb20cfc7..a365371a88687 100644 --- a/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs +++ b/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs @@ -985,6 +985,13 @@ private static bool CheckConstraints( ignoreTypeConstraintsDependentOnTypeParametersOpt); bool hasError = false; + if (typeArgument.Type is NamedTypeSymbol { IsInterface: true } iface && SelfOrBaseHasStaticAbstractMember(iface, ref useSiteInfo, out Symbol member)) + { + diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, + new UseSiteInfo(new CSDiagnosticInfo(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, iface, member)))); + hasError = true; + } + foreach (var constraintType in constraintTypes) { CheckConstraintType(containingSymbol, in args, typeParameter, typeArgument, diagnosticsBuilder, nullabilityDiagnosticsBuilderOpt, ref useSiteInfo, constraintType, ref hasError); @@ -1078,20 +1085,7 @@ private static void CheckConstraintType( ErrorCode errorCode; if (typeArgument.Type.IsReferenceType) { - // When constraint has static abstract members this needs to be further restricted so that generic argument cannot itself be an interface. - if (typeArgument.Type.IsInterfaceType() && constraintType.Type.IsInterfaceType() && - args.Conversions.WithNullability(false).HasIdentityOrImplicitReferenceConversion(typeArgument.Type, constraintType.Type, ref useSiteInfo)) - { -#if DEBUG - var discardedUseSiteInfo = CompoundUseSiteInfo.Discarded; - Debug.Assert(SelfOrBaseHasStaticAbstractMember(constraintType, ref discardedUseSiteInfo)); -#endif - errorCode = ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers; - } - else - { - errorCode = ErrorCode.ERR_GenericConstraintNotSatisfiedRefType; - } + errorCode = ErrorCode.ERR_GenericConstraintNotSatisfiedRefType; } else if (typeArgument.IsNullableType()) { @@ -1261,13 +1255,6 @@ private static bool SatisfiesConstraintType( if (conversions.HasIdentityOrImplicitReferenceConversion(typeArgument.Type, constraintType.Type, ref useSiteInfo)) { - // When constraint has static abstract members this needs to be further restricted so that generic argument cannot itself be an interface. - if (typeArgument.Type.IsInterfaceType() && constraintType.Type.IsInterfaceType() && - SelfOrBaseHasStaticAbstractMember(constraintType, ref useSiteInfo)) - { - return false; - } - return true; } @@ -1305,29 +1292,34 @@ private static bool SatisfiesConstraintType( return false; } - private static bool SelfOrBaseHasStaticAbstractMember(TypeWithAnnotations constraintType, ref CompoundUseSiteInfo useSiteInfo) + private static bool SelfOrBaseHasStaticAbstractMember(NamedTypeSymbol iface, ref CompoundUseSiteInfo useSiteInfo, out Symbol memberWithoutImplementation) { - Debug.Assert(constraintType.Type.IsInterfaceType()); - - Func predicate = static m => m.IsStatic && (m.IsAbstract || m.IsVirtual); - var definition = (NamedTypeSymbol)constraintType.Type.OriginalDefinition; + Debug.Assert(iface.IsInterfaceType()); - if (definition.GetMembersUnordered().Any(predicate)) + foreach (Symbol m in iface.GetMembers()) { - return true; + if (m.IsStatic && m.IsImplementableInterfaceMember() && iface.FindImplementationForInterfaceMember(m) is null) + { + memberWithoutImplementation = m; + return true; + } } - foreach (var baseInterface in definition.InterfacesAndTheirBaseInterfacesNoUseSiteDiagnostics.Keys) + foreach (var baseInterface in iface.InterfacesAndTheirBaseInterfacesNoUseSiteDiagnostics.Keys) { - var baseDefinition = baseInterface.OriginalDefinition; - if (baseDefinition.GetMembersUnordered().Any(predicate)) + foreach (Symbol m in baseInterface.GetMembers()) { - return true; + if (m.IsStatic && m.IsImplementableInterfaceMember() && iface.FindImplementationForInterfaceMember(m) is null) + { + memberWithoutImplementation = m; + return true; + } } - baseDefinition.AddUseSiteInfo(ref useSiteInfo); + baseInterface.OriginalDefinition.AddUseSiteInfo(ref useSiteInfo); } + memberWithoutImplementation = null; return false; } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs index 14d04098197b7..00951c8b6f970 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs @@ -1609,7 +1609,7 @@ private void CheckInterfaceUnification(BindingDiagnosticBag diagnostics) { foreach (Diagnostic diagnostic in implementingMemberAndDiagnostics.Diagnostics.Diagnostics) { - if (diagnostic.Severity == DiagnosticSeverity.Error && diagnostic.Code is not (int)ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember) + if (diagnostic.Severity == DiagnosticSeverity.Error && diagnostic.Code is not ((int)ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember or (int)ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember)) { return default; } diff --git a/src/Compilers/CSharp/Portable/Symbols/TypeParameterSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/TypeParameterSymbol.cs index f2b2ea25a8e1d..72c230053444e 100644 --- a/src/Compilers/CSharp/Portable/Symbols/TypeParameterSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/TypeParameterSymbol.cs @@ -290,6 +290,18 @@ internal ImmutableArray EffectiveInterfacesNoUseSiteDiagnostics } } + internal ImmutableArray EffectiveInterfacesWithDefinitionUseSiteDiagnostics(ref CompoundUseSiteInfo useSiteInfo) + { + var result = EffectiveInterfacesNoUseSiteDiagnostics; + + foreach (var iface in result) + { + iface.OriginalDefinition.AddUseSiteInfo(ref useSiteInfo); + } + + return result; + } + /// /// The most encompassed type (spec 6.4.2) from the constraints. /// diff --git a/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs index 7c5955a729141..7442b41561752 100644 --- a/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs @@ -996,23 +996,44 @@ private static Symbol ComputeImplementationForInterfaceMember(Symbol interfaceMe { if ((object)implicitImpl != null) { - if (!canBeImplementedImplicitlyInCSharp9) + bool suppressRegularValidation = false; + + if (!canBeImplementedImplicitlyInCSharp9 && interfaceMember.Kind == SymbolKind.Method && + (object)implementingBaseOpt == null) // Otherwise any appropriate errors are going to be reported for the base. { - if (interfaceMember.Kind == SymbolKind.Method && - (object)implementingBaseOpt == null) // Otherwise any approprite errors are going to be reported for the base. + var useSiteInfo2 = compilation is object ? new CompoundUseSiteInfo(diagnostics, compilation.Assembly) : CompoundUseSiteInfo.DiscardedDependencies; + + if (implementingType is NamedTypeSymbol named && + !AccessCheck.IsSymbolAccessible(interfaceMember, named, ref useSiteInfo2, throughTypeOpt: null)) + { + diagnostics.Add(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl), implementingType, interfaceMember, implicitImpl); + suppressRegularValidation = true; + } + else if (!interfaceMember.IsStatic) { LanguageVersion requiredVersion = MessageID.IDS_FeatureImplicitImplementationOfNonPublicMembers.RequiredVersion(); LanguageVersion? availableVersion = implementingType.DeclaringCompilation?.LanguageVersion; if (requiredVersion > availableVersion) { - diagnostics.Add(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, GetInterfaceLocation(interfaceMember, implementingType), + diagnostics.Add(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl), implementingType, interfaceMember, implicitImpl, availableVersion.GetValueOrDefault().ToDisplayString(), new CSharpRequiredLanguageVersion(requiredVersion)); } } + + diagnostics.Add( +#if !DEBUG + // Don't optimize in DEBUG for better coverage for the GetInterfaceLocation function. + useSiteInfo2.Diagnostics is null ? Location.None : +#endif + GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl), + useSiteInfo2); } - ReportImplicitImplementationMatchDiagnostics(interfaceMember, implementingType, implicitImpl, diagnostics); + if (!suppressRegularValidation) + { + ReportImplicitImplementationMatchDiagnostics(interfaceMember, implementingType, implicitImpl, diagnostics); + } } else if ((object)closestMismatch != null) { diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf index 705bb52302be9..9107d38fdcb41 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - Rozhraní {3} nelze použít jako parametr obecného typu {2} v obecném typu nebo metodě {0}. Rozhraní s omezením {1} nebo jeho základní rozhraní má statické abstraktní členy. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. Volání implicitního indexeru indexů nemůže pojmenovat argument. @@ -837,6 +842,11 @@ Hodnota direktivy #line chybí nebo je mimo rozsah. + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. Vzory seznamů nelze použít pro hodnotu typu {0}. Nenašla se žádná vhodná vlastnost Length nebo Count. @@ -1577,11 +1587,6 @@ návratový typ lambda - - line span directive - direktiva line span - - list pattern vzor seznamu diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf index 738cf7d8191c8..06bcf1349cf24 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - Die Schnittstelle „{3}“ kann nicht als Typparameter „{2}“ im generischen Typ oder in der Methode „{0}“ verwendet werden. Die Einschränkungsschnittstelle „{1}“ oder die Basisschnittstelle weist statische abstrakte Elemente auf. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. Durch den Aufruf des impliziten Indexindexers kann das Argument nicht benannt werden. @@ -837,6 +842,11 @@ Der Wert der #line-Anweisung fehlt oder liegt außerhalb des gültigen Bereichs. + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. Listenmuster dürfen nicht für einen Wert vom Typ „{0}“ verwendet werden. Es wurde keine geeignete Längen- oder Anzahl-Eigenschaft gefunden. @@ -1577,11 +1587,6 @@ Lambda-Rückgabetyp - - line span directive - Zeilenabstand-Anweisung - - list pattern Listenmuster diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf index cd26a9aed72bf..82b93565f069e 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - La interfaz "{3}" no se puede usar como parámetro de tipo "{2}" en el tipo o método genérico "{0}". La interfaz de restricción "{1}" o su interfaz base tiene miembros abstractos estáticos. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. La invocación del indizador de índices implícito no puede nombrar el argumento. @@ -837,6 +842,11 @@ Falta el valor de directiva #line o está fuera del rango + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. No se pueden usar patrones de lista para un valor de tipo \"{0}\". No se encontró ninguna propiedad \"Length\" o \"Count\" adecuada. @@ -1577,11 +1587,6 @@ tipo de valor devuelto de lambda - - line span directive - directiva de intervalo de línea - - list pattern patrón de lista diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf index bdc7bd13c0ef4..76efa2ef017a8 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - L’interface « {3} » ne peut pas être utilisée comme paramètre de type « {2} » dans le type ou la méthode générique « {0} ». L’interface de contrainte « {1} » ou son interface de base a des membres abstraits statiques. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. L'appel de l'indexeur d'index implicite ne peut pas nommer l'argument. @@ -837,6 +842,11 @@ La valeur de directive #line est manquante ou hors limites + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. Les modèles de liste ne peuvent pas être utilisés pour une valeur de type '{0}'. Aucune propriété 'Longueur' ou 'Compte' appropriée n’a été trouvée. @@ -1577,11 +1587,6 @@ type de retour lambda - - line span directive - directive de l’étendue de ligne - - list pattern modèle de liste diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf index c5257dc722735..1d351656705c5 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - Non è possibile usare l'interfaccia '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. L'interfaccia di vincolo '{1}' o la relativa interfaccia di base contiene membri statici astratti. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. La chiamata dell'indicizzatore di indice implicito non può assegnare un nome all'argomento. @@ -837,6 +842,11 @@ Il valore della direttiva #line manca oppure non è compreso nell'intervallo + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. I criteri di elenco non possono essere utilizzati per un valore di tipo '{0}'. Non è stata trovata alcuna proprietà 'Length' o 'Count' appropriata. @@ -1577,11 +1587,6 @@ tipo restituito dell'espressione lambda - - line span directive - direttiva per intervallo di riga - - list pattern modello di elenco diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf index c1f8f1aa44805..a26d48e06359d 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - インターフェイス '{3}' をジェネリック型またはメソッド '{0}' で型パラメーター '{2}' として使用することはできません。制約インターフェイス '{1}' またはその基本インターフェイスに、静的な抽象メンバーが含まれています。 + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. 暗黙的なインデックス インデクサーの呼び出しでは、引数に名前を付けることはできません。 @@ -837,6 +842,11 @@ #line ディレクティブの値が見つからないか、範囲外です + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. リスト パターンは、型 '{0}' の値には使用できません。適切な 'Length' または 'Count' プロパティが見つかりませんでした。 @@ -1577,11 +1587,6 @@ ラムダ戻り値の型 - - line span directive - line span ディレクティブ - - list pattern リスト パターン diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf index 8b0a5edeecb24..bd04981258c72 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - 인터페이스 '{3}'은(는) 제네릭 유형 또는 메소드 '{0}'에서 유형 매개 변수 '{2}'(으)로 사용할 수 없습니다. 제약 조건 인터페이스 '{1}' 또는 기본 인터페이스에 정적 추상 멤버가 있습니다. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. 암시적 인덱스 인덱서 호출로 인수 이름을 지정할 수 없습니다. @@ -837,6 +842,11 @@ #line 지시문 값이 없거나 범위를 벗어났습니다. + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. 목록 패턴은 '{0}' 형식의 값에 사용할 수 없습니다. 적합한 'Length' 또는 'Count' 속성을 찾을 수 없습니다. @@ -1577,11 +1587,6 @@ 람다 반환 유형 - - line span directive - 라인 범위 지시문 - - list pattern 목록 패턴 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf index 45f669a3e71c6..32a438a1adf15 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - Interfejsu "{3}" nie można użyć jako parametru typu "{2}" w typie ogólnym lub metodzie "{0}". Interfejs ograniczenia "{1}" lub jego interfejs podstawowy ma statyczne składowe abstrakcyjne. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. W wywołaniu niejawnego indeksatora indeksu nie może być nazwy argumentu. @@ -837,6 +842,11 @@ Brak wartości dyrektywy #line lub jest ona poza zakresem + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. Wzorce listy nie mogą być używane dla wartości typu „{0}”. Nie znaleziono odpowiedniej właściwości „Długość” ani „Liczba”. @@ -1577,11 +1587,6 @@ zwracany typ lambda - - line span directive - dyrektywa zakresu wierszy - - list pattern wzorzec listy diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf index f89d211e56616..591357163e376 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - A interface '{3}' não pode ser usada como o parâmetro de tipo '{2}' no tipo ou método genérico '{0}'. A interface de restrição '{1}' ou sua interface base tem membros abstratos estáticos. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. A invocação do Indexador de Índice implícito não pode nomear o argumento. @@ -837,6 +842,11 @@ O valor da diretiva de #line está ausente ou fora do intervalo + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. Padrões de lista não podem ser usados para um valor do tipo “{0}”. Nenhuma propriedade “Length” ou “Count” adequada foi encontrada. @@ -1577,11 +1587,6 @@ tipo de retorno de lambda - - line span directive - diretiva de extensão de linha - - list pattern padrão de lista diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf index 30c7985df5171..85aa878b454bd 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - Невозможно использовать интерфейс "{3}" в качестве параметра типа "{2}" в универсальном типе или методе "{0}". Интерфейс ограничения "{1}" или его базовый интерфейс содержит статические абстрактные элементы. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. Вызов неявного индексатора для индекса не может присвоить аргументу имя. @@ -837,6 +842,11 @@ Значение директивы #line отсутствует или находится за пределами допустимого диапазона + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. Шаблоны списка не могут использоваться для значения типа {0}. Подходящее свойство \"Length\" или \"Count\" не найдено. @@ -1577,11 +1587,6 @@ тип возвращаемого значения лямбда - - line span directive - директива line span - - list pattern шаблон списка diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf index 78fe1007cf2b9..9bfa411e7c8af 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - '{3}' arabirimi '{2}' tür parametresi olarak '{0}' genel türünde veya yönteminde kullanılamaz. '{1}' kısıtlama arabirimi veya onun temel arabirimi, statik soyut üyelere sahip. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. Örtük Dizin Oluşturucu'nun çağrılması bağımsız değişkeni adlandıramaz. @@ -837,6 +842,11 @@ #line yönerge değeri eksik veya aralık dışı + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. Liste desenleri, '{0}' türündeki bir değer için kullanılamaz. Uygun 'Length' veya 'Count' özelliği bulunamadı. @@ -1577,11 +1587,6 @@ lambda dönüş türü - - line span directive - satır aralığı yönergesi - - list pattern liste deseni diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf index 10822f4c623f3..efb086f71931a 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - 接口“{3}”不能用作泛型类型或方法“{2}”中的类型参数“{0}”。约束接口“{1}”或其基接口具有静态抽象成员。 + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. 无法通过对隐式索引索引器的调用为参数命名。 @@ -837,6 +842,11 @@ #line 指令值缺失或超出范围 + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. 列表模式不能用于 '{0}' 类型的值。找不到合适的 \"Length\" 或 \"Count\" 属性。 @@ -1577,11 +1587,6 @@ lambda 返回类型 - - line span directive - 行跨度指令 - - list pattern 列表模式 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf index fd727d9767934..43ebf5ec70aab 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf @@ -593,8 +593,8 @@ - The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract or virtual members. - 無法使用介面 '{3}' 作為泛型型別或方法 '{0}' 中的型別參數 '{2}'。限制式介面 '{1}' 或其基底介面具有靜態抽象成員。 + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. + The interface '{0}' cannot be used as type argument. Static member '{1}' does not have a most specific implementation in the interface. @@ -637,6 +637,11 @@ An 'implicit' user-defined conversion operator cannot be declared checked + + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + '{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement an inaccessible member. + + Invocation of implicit Index Indexer cannot name the argument. 隱含 Index 索引子的引動過程無法為引數命名。 @@ -837,6 +842,11 @@ #Line 指示詞值遺漏或超出範圍 + + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + + List patterns may not be used for a value of type '{0}'. No suitable 'Length' or 'Count' property was found. 清單模式不能用於型別 '{0}' 的值。找不到適當的 'Length' 或 'Count' 屬性。 @@ -1577,11 +1587,6 @@ lambda 傳回型別 - - line span directive - line span 指示詞 - - list pattern 清單模式 diff --git a/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests.cs b/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests.cs index 7671781514dc4..75d93a1dc8865 100644 --- a/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests.cs +++ b/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests.cs @@ -10521,12 +10521,19 @@ class C2 { } // (8,26): error CS8919: Target runtime doesn't support static abstract members in interfaces. // static abstract void M(); Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, "M").WithLocation(8, 26), - // (19,8): error CS8920: The interface 'I1' cannot be used as type parameter 'T' in the generic type or method 'Attr2'. The constraint interface 'I1' or its base interface has static abstract or virtual members. + // (18,8): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.M()' does not have a most specific implementation in the interface. + // [Attr1] + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "I1").WithArguments("I1", "I1.M()").WithLocation(18, 8), + // (19,8): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.M()' does not have a most specific implementation in the interface. // [Attr2] - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "I1").WithArguments("Attr2", "I1", "T", "I1").WithLocation(19, 8), - // (23,8): error CS8920: The interface 'I2' cannot be used as type parameter 'T' in the generic type or method 'Attr2'. The constraint interface 'I1' or its base interface has static abstract or virtual members. + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "I1").WithArguments("I1", "I1.M()").WithLocation(19, 8), + // (22,8): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M()' does not have a most specific implementation in the interface. + // [Attr1] + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "I2").WithArguments("I2", "I1.M()").WithLocation(22, 8), + // (23,8): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M()' does not have a most specific implementation in the interface. // [Attr2] - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "I2").WithArguments("Attr2", "I1", "T", "I2").WithLocation(23, 8)); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "I2").WithArguments("I2", "I1.M()").WithLocation(23, 8) + ); } [Fact] diff --git a/src/Compilers/CSharp/Test/Symbol/BadSymbolReference.cs b/src/Compilers/CSharp/Test/Symbol/BadSymbolReference.cs index 33308ff08e517..8e4ab199a9d81 100644 --- a/src/Compilers/CSharp/Test/Symbol/BadSymbolReference.cs +++ b/src/Compilers/CSharp/Test/Symbol/BadSymbolReference.cs @@ -287,6 +287,12 @@ interface I1 // (137,15): error CS0012: The type 'CL2_I1' is defined in an assembly that is not referenced. You must add a reference to assembly 'CL2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // interface I2 : CL3_I1, I1 Diagnostic(ErrorCode.ERR_NoTypeDef, "I2").WithArguments("CL2_I1", "CL2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(137, 15), + // (140,11): error CS0012: The type 'CL2_I1' is defined in an assembly that is not referenced. You must add a reference to assembly 'CL2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. + // class C5 : CL3_I1, I1 + Diagnostic(ErrorCode.ERR_NoTypeDef, "C5").WithArguments("CL2_I1", "CL2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(140, 11), + // (137,15): error CS0012: The type 'CL2_I1' is defined in an assembly that is not referenced. You must add a reference to assembly 'CL2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. + // interface I2 : CL3_I1, I1 + Diagnostic(ErrorCode.ERR_NoTypeDef, "I2").WithArguments("CL2_I1", "CL2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(137, 15), // (9,16): warning CS0219: The variable 'x1' is assigned but its value is never used // CL3_C1 x1; Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "x1").WithArguments("x1").WithLocation(9, 16), @@ -477,6 +483,12 @@ public interface CL3_I1 : CL2_I1 // (137,15): error CS0246: The type or namespace name 'CL2_I1' could not be found (are you missing a using directive or an assembly reference?) // interface I2 : CL3_I1, I1 Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "I2").WithArguments("CL2_I1").WithLocation(137, 15), + // (140,11): error CS0246: The type or namespace name 'CL2_I1' could not be found (are you missing a using directive or an assembly reference?) + // class C5 : CL3_I1, I1 + Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "C5").WithArguments("CL2_I1").WithLocation(140, 11), + // (137,15): error CS0246: The type or namespace name 'CL2_I1' could not be found (are you missing a using directive or an assembly reference?) + // interface I2 : CL3_I1, I1 + Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "I2").WithArguments("CL2_I1").WithLocation(137, 15), // (9,16): warning CS0219: The variable 'x1' is assigned but its value is never used // CL3_C1 x1; Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "x1").WithArguments("x1").WithLocation(9, 16), diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs index b4db17a381128..b60f02b7004bf 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs @@ -5,14 +5,9 @@ #nullable disable using System; -using System.Collections.Immutable; -using System.Diagnostics; using System.Linq; -using System.Text; -using System.Threading; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; @@ -8969,16 +8964,39 @@ class Test1 : I1 Assert.Null(test1.FindImplementationForInterfaceMember(m3)); } - [Fact] - public void MethodModifiers_10_01() + [Theory] + [CombinatorialData] + public void MethodModifiers_10_01(bool isStatic) { + string declModifiers = isStatic ? "static " : ""; + var source1 = @" public interface I1 -{ +{ " + declModifiers + @" internal abstract void M1(); +"; + if (!isStatic) + { + source1 += +@" void M2() {M1();} +"; + } + else + { + source1 += +@" + static void M2() where T : I1 + { + T.M1(); + } +"; + } + + source1 += +@" } "; @@ -8986,45 +9004,85 @@ public interface I1 @" class Test1 : I1 { + " + declModifiers + @" + public void M1() + { + System.Console.WriteLine(""M1""); + } +"; + if (!isStatic) + { + source2 += +@" static void Main() { I1 x = new Test1(); x.M2(); } +"; + } + else + { + source2 += +@" + static void Main() + { + Test(); + } - public void M1() + static void Test() where T : I1 { - System.Console.WriteLine(""M1""); + I1.M2(); } +"; + } + + source2 += +@" } "; var compilation1 = CreateCompilation(source1 + source2, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net60); Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation1.VerifyDiagnostics( - // (9,15): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(9, 15) - ); - ValidateMethodModifiersImplicit_10(compilation1.SourceModule, Accessibility.Internal); + if (!isStatic) + { + compilation1.VerifyDiagnostics( + // (14,17): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(14, 17) + ); + } + else + { + compilation1.VerifyDiagnostics( + // (4,28): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. + // internal abstract void M1(); + Diagnostic(ErrorCode.ERR_InvalidModifierForLanguageVersion, "M1").WithArguments("abstract", "9.0", "preview").WithLocation(4, 28), + // (9,9): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // T.M1(); + Diagnostic(ErrorCode.ERR_FeatureInPreview, "T").WithArguments("static abstract members in interfaces").WithLocation(9, 9) + ); + } + + ValidateMethodModifiersImplicit_10(compilation1.SourceModule, Accessibility.Internal, isStatic: isStatic); compilation1 = CreateCompilation(source1 + source2, options: TestOptions.DebugExe, - parseOptions: TestOptions.Regular10, - targetFramework: TargetFramework.NetCoreApp); + parseOptions: isStatic ? TestOptions.RegularNext : TestOptions.Regular10, + targetFramework: TargetFramework.Net60); Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - CompileAndVerify(compilation1, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : "M1", verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateMethodModifiersImplicit_10(m, Accessibility.Internal)).VerifyDiagnostics(); + CompileAndVerify(compilation1, expectedOutput: !Execute(isStatic) ? null : "M1", verify: Verify(isStatic), symbolValidator: (m) => ValidateMethodModifiersImplicit_10(m, Accessibility.Internal, isStatic: isStatic)).VerifyDiagnostics(); - ValidateMethodModifiersImplicit_10(compilation1.SourceModule, Accessibility.Internal); + ValidateMethodModifiersImplicit_10(compilation1.SourceModule, Accessibility.Internal, isStatic: isStatic); var compilation2 = CreateCompilation(source1, options: TestOptions.DebugDll, - parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + parseOptions: TestOptions.RegularPreview, + targetFramework: TargetFramework.Net60); Assert.True(compilation2.Assembly.RuntimeSupportsDefaultInterfaceImplementation); compilation2.VerifyDiagnostics(); - ValidateMethodModifiers_10(compilation2.GetTypeByMetadataName("I1").GetMember("M1"), Accessibility.Internal); + ValidateMethodModifiers_10(compilation2.GetTypeByMetadataName("I1").GetMember("M1"), Accessibility.Internal, isStatic: isStatic); var source3 = @@ -9038,27 +9096,33 @@ class Test2 : I1 { var compilation3 = CreateCompilation(source2, new[] { reference }, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net60); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); + compilation3.VerifyDiagnostics( - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 15) + // (5,17): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(5, 17) ); - ValidateMethodModifiersImplicit_10(compilation3.SourceModule, Accessibility.Internal); + ValidateMethodModifiersImplicit_10(compilation3.SourceModule, Accessibility.Internal, isStatic: isStatic); compilation3 = CreateCompilation(source2, new[] { reference }, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular10, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net60); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : "M1", verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateMethodModifiersImplicit_10(m, Accessibility.Internal)).VerifyDiagnostics(); - ValidateMethodModifiersImplicit_10(compilation3.SourceModule, Accessibility.Internal); + compilation3.VerifyDiagnostics( + // (5,17): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(5, 17) + ); + + ValidateMethodModifiersImplicit_10(compilation3.SourceModule, Accessibility.Internal, isStatic: isStatic); var compilation5 = CreateCompilation(source3, new[] { reference }, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net60); Assert.True(compilation5.Assembly.RuntimeSupportsDefaultInterfaceImplementation); compilation5.VerifyDiagnostics( // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.M1()' @@ -9078,9 +9142,9 @@ private static void ValidateI1M1NotImplemented(CSharpCompilation compilation, st Assert.Null(test2.FindImplementationForInterfaceMember(m1)); } - private static void ValidateMethodModifiersImplicit_10(ModuleSymbol m, Accessibility accessibility) + private static void ValidateMethodModifiersImplicit_10(ModuleSymbol m, Accessibility accessibility, bool isStatic = false) { - ValidateMethodModifiers_10(m, implementedByBase: false, isExplicit: false, accessibility); + ValidateMethodModifiers_10(m, implementedByBase: false, isExplicit: false, accessibility, isStatic: isStatic); } private static void ValidateMethodModifiersExplicit_10(ModuleSymbol m, Accessibility accessibility) @@ -9098,27 +9162,27 @@ private static void ValidateMethodModifiersExplicitInTest2_10(ModuleSymbol m, Ac ValidateMethodModifiers_10(m, implementedByBase: true, isExplicit: true, accessibility); } - private static void ValidateMethodModifiers_10(ModuleSymbol m, bool implementedByBase, bool isExplicit, Accessibility accessibility) + private static void ValidateMethodModifiers_10(ModuleSymbol m, bool implementedByBase, bool isExplicit, Accessibility accessibility, bool isStatic = false) { var test1 = m.GlobalNamespace.GetTypeMember("Test1"); var i1 = test1.InterfacesNoUseSiteDiagnostics().Where(i => i.Name == "I1").Single(); var m1 = i1.GetMember("M1"); - ValidateMethodModifiers_10(m1, accessibility); + ValidateMethodModifiers_10(m1, accessibility, isStatic: isStatic); var implementation = (implementedByBase ? test1.BaseTypeNoUseSiteDiagnostics : test1).GetMember((isExplicit ? "I1." : "") + "M1"); Assert.NotNull(implementation); Assert.Same(implementation, test1.FindImplementationForInterfaceMember(m1)); - Assert.True(implementation.IsMetadataVirtual()); + Assert.Equal(!isStatic, implementation.IsMetadataVirtual()); } - private static void ValidateMethodModifiers_10(MethodSymbol m1, Accessibility accessibility) + private static void ValidateMethodModifiers_10(MethodSymbol m1, Accessibility accessibility, bool isStatic = false) { Assert.True(m1.IsAbstract); Assert.False(m1.IsVirtual); Assert.True(m1.IsMetadataVirtual()); Assert.False(m1.IsSealed); - Assert.False(m1.IsStatic); + Assert.Equal(isStatic, m1.IsStatic); Assert.False(m1.IsExtern); Assert.False(m1.IsAsync); Assert.False(m1.IsOverride); @@ -9158,55 +9222,91 @@ public virtual void M1() "; ValidateMethodModifiers_10_02(source1, source2, Accessibility.Internal, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (9,25): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public virtual void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(9, 25) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,25): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public virtual void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(9, 25) + ) ); } + private static DiagnosticDescription[] ExpectedDiagnostics(params DiagnosticDescription[] array) => array; + private void ValidateMethodModifiers_10_02(string source1, string source2, Accessibility accessibility, params DiagnosticDescription[] expectedIn9) + { + ValidateMethodModifiers_10_02(source1, source2, accessibility, expectedIn9, expectedIn9AcrossAssemblyBoundaries: expectedIn9, expectedAcrossAssemblyBoundaries: Array.Empty()); + } + + private void ValidateMethodModifiers_10_02(string source1, string source2, + Accessibility accessibility, + DiagnosticDescription[] expectedIn9, + params DiagnosticDescription[] expectedAcrossAssemblyBoundaries) + { + ValidateMethodModifiers_10_02(source1, source2, accessibility, expectedIn9, expectedIn9AcrossAssemblyBoundaries: expectedIn9, expectedAcrossAssemblyBoundaries); + } + + private void ValidateMethodModifiers_10_02(string source1, string source2, + Accessibility accessibility, + DiagnosticDescription[] expectedIn9, + DiagnosticDescription[] expectedIn9AcrossAssemblyBoundaries, + DiagnosticDescription[] expectedAcrossAssemblyBoundaries, + bool isStatic = false) { var compilation1 = CreateCompilation(source2 + source1, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net60); Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); compilation1.VerifyDiagnostics(expectedIn9); - ValidateMethodModifiersImplicit_10(compilation1.SourceModule, accessibility); + ValidateMethodModifiersImplicit_10(compilation1.SourceModule, accessibility, isStatic: isStatic); compilation1 = CreateCompilation(source2 + source1, options: TestOptions.DebugExe, - parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); - CompileAndVerify(compilation1, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : "Test1.M1", verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateMethodModifiersImplicit_10(m, accessibility)).VerifyDiagnostics(); + parseOptions: TestOptions.RegularPreview, + targetFramework: TargetFramework.Net60); + CompileAndVerify(compilation1, expectedOutput: !Execute(isStatic) ? null : "Test1.M1", verify: Verify(isStatic), symbolValidator: (m) => ValidateMethodModifiersImplicit_10(m, accessibility, isStatic: isStatic)).VerifyDiagnostics(); - ValidateMethodModifiersImplicit_10(compilation1.SourceModule, accessibility); + ValidateMethodModifiersImplicit_10(compilation1.SourceModule, accessibility, isStatic: isStatic); var compilation2 = CreateCompilation(source1, options: TestOptions.DebugDll, - parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + parseOptions: TestOptions.RegularPreview, + targetFramework: TargetFramework.Net60); Assert.True(compilation2.Assembly.RuntimeSupportsDefaultInterfaceImplementation); compilation2.VerifyDiagnostics(); - ValidateMethodModifiers_10(compilation2.GetTypeByMetadataName("I1").GetMember("M1"), accessibility); + ValidateMethodModifiers_10(compilation2.GetTypeByMetadataName("I1").GetMember("M1"), accessibility, isStatic: isStatic); foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) { var compilation3 = CreateCompilation(source2, new[] { reference }, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net60); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation3.VerifyDiagnostics(expectedIn9); - ValidateMethodModifiersImplicit_10(compilation3.SourceModule, accessibility); + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries.Length != 0 ? expectedAcrossAssemblyBoundaries : expectedIn9AcrossAssemblyBoundaries); + + ValidateMethodModifiersImplicit_10(compilation3.SourceModule, accessibility, isStatic: isStatic); compilation3 = CreateCompilation(source2, new[] { reference }, options: TestOptions.DebugExe, - parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : "Test1.M1", verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateMethodModifiersImplicit_10(m, accessibility)).VerifyDiagnostics(); + parseOptions: TestOptions.RegularPreview, + targetFramework: TargetFramework.Net60); + + if (expectedAcrossAssemblyBoundaries.Length != 0) + { + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries); + } + else + { + CompileAndVerify(compilation3, expectedOutput: !Execute(isStatic) ? null : "Test1.M1", verify: Verify(isStatic), symbolValidator: (m) => ValidateMethodModifiersImplicit_10(m, accessibility, isStatic: isStatic)).VerifyDiagnostics(); + } - ValidateMethodModifiersImplicit_10(compilation3.SourceModule, accessibility); + ValidateMethodModifiersImplicit_10(compilation3.SourceModule, accessibility, isStatic: isStatic); } } @@ -9318,9 +9418,16 @@ public void M1() } "; ValidateMethodModifiers_10_02(source1, source2, Accessibility.Internal, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,17): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(9, 17) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,17): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(9, 17) + ) ); } @@ -9364,9 +9471,16 @@ public virtual void M1() } "; ValidateMethodModifiers_10_02(source1, source2, Accessibility.Internal, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,25): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public virtual void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(9, 25) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,25): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public virtual void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(9, 25) + ) ); } @@ -9415,9 +9529,16 @@ public override void M1() } "; ValidateMethodModifiers_10_02(source1, source2, Accessibility.Internal, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,26): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract void M1(); + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(9, 26) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,26): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public abstract void M1(); + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(9, 26) + ) ); } @@ -9466,9 +9587,16 @@ public interface I2 } "; ValidateMethodModifiers_10_02(source1, source2, Accessibility.Internal, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,17): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(9, 17) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,17): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(9, 17) + ) ); } @@ -9653,9 +9781,9 @@ static void Main() targetFramework: TargetFramework.NetCoreApp); compilation1.VerifyDiagnostics( - // (9,15): error CS8704: 'Test2' does not implement interface member 'I1.M1()'. 'Test2.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.M1()", "Test2.M1()", "9.0", "10.0").WithLocation(9, 15) + // (11,17): error CS8704: 'Test2' does not implement interface member 'I1.M1()'. 'Test2.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test2", "I1.M1()", "Test2.M1()", "9.0", "10.0").WithLocation(11, 17) ); ValidateMethodModifiersImplicitInTest2_10(compilation1.SourceModule, Accessibility.Internal); @@ -9678,25 +9806,20 @@ static void Main() foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) { - var compilation3 = CreateCompilation(source2, new[] { reference }, options: TestOptions.DebugExe, - parseOptions: TestOptions.Regular9, - targetFramework: TargetFramework.NetCoreApp); - - compilation3.VerifyDiagnostics( - // (2,15): error CS8704: 'Test2' does not implement interface member 'I1.M1()'. 'Test2.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.M1()", "Test2.M1()", "9.0", "10.0").WithLocation(2, 15) - ); - - ValidateMethodModifiersImplicitInTest2_10(compilation3.SourceModule, Accessibility.Internal); - - compilation3 = CreateCompilation(source2, new[] { reference }, options: TestOptions.DebugExe, - parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + foreach (var parseOptions in new[] { TestOptions.Regular9, TestOptions.Regular }) + { + var compilation3 = CreateCompilation(source2, new[] { reference }, options: TestOptions.DebugExe, + parseOptions: parseOptions, + targetFramework: TargetFramework.NetCoreApp); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : "M1", verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateMethodModifiersImplicitInTest2_10(m, Accessibility.Internal)).VerifyDiagnostics(); + compilation3.VerifyDiagnostics( + // (4,17): error CS9044: 'Test2' does not implement interface member 'I1.M1()'. 'Test2.M1()' cannot implicitly implement an inaccessible member. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test2", "I1.M1()", "Test2.M1()").WithLocation(4, 17) + ); - ValidateMethodModifiersImplicitInTest2_10(compilation3.SourceModule, Accessibility.Internal); + ValidateMethodModifiersImplicitInTest2_10(compilation3.SourceModule, Accessibility.Internal); + } } } @@ -11542,9 +11665,9 @@ public void M1() Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); var expected = new DiagnosticDescription[] { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 15), + // (10,17): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(10, 17), // (7,11): error CS1540: Cannot access protected member 'I1.M1()' via a qualifier of type 'I1'; the qualifier must be of type 'Test1' (or derived from it) // x.M1(); Diagnostic(ErrorCode.ERR_BadProtectedAccess, "M1").WithArguments("I1.M1()", "I1", "Test1").WithLocation(7, 11) @@ -11680,9 +11803,9 @@ public virtual void M1() Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); compilation1.VerifyDiagnostics( - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 15) + // (10,25): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public virtual void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(10, 25) ); ValidateMethodModifiersImplicit_10(compilation1.SourceModule, Accessibility.ProtectedOrInternal); @@ -11719,9 +11842,9 @@ class Test2 : I1 targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); compilation3.VerifyDiagnostics( - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 15), + // (10,25): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public virtual void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(10, 25), // (7,11): error CS1540: Cannot access protected member 'I1.M1()' via a qualifier of type 'I1'; the qualifier must be of type 'Test1' (or derived from it) // x.M1(); Diagnostic(ErrorCode.ERR_BadProtectedAccess, "M1").WithArguments("I1.M1()", "I1", "Test1").WithLocation(7, 11) @@ -11801,9 +11924,9 @@ public void M1() Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); compilation1.VerifyDiagnostics( - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 15), + // (10,17): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(10, 17), // (7,11): error CS1540: Cannot access protected member 'I1.M1()' via a qualifier of type 'I1'; the qualifier must be of type 'Test1' (or derived from it) // x.M1(); Diagnostic(ErrorCode.ERR_BadProtectedAccess, "M1").WithArguments("I1.M1()", "I1", "Test1").WithLocation(7, 11) @@ -11843,9 +11966,9 @@ class Test2 : I1 targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); compilation3.VerifyDiagnostics( - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 15), + // (10,17): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(10, 17), // (7,11): error CS0122: 'I1.M1()' is inaccessible due to its protection level // x.M1(); Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I1.M1()").WithLocation(7, 11) @@ -11858,7 +11981,12 @@ class Test2 : I1 targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : "M1", verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateMethodModifiersImplicit_10(m, Accessibility.ProtectedAndInternal)).VerifyDiagnostics(); + compilation3.VerifyDiagnostics( + // (10,17): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(10, 17) + ); + ValidateMethodModifiersImplicit_10(compilation3.SourceModule, Accessibility.ProtectedAndInternal); var compilation5 = CreateCompilation(source3, new[] { reference }, options: TestOptions.DebugDll, @@ -12060,19 +12188,43 @@ void I1.M1() } } - [Fact] - public void MethodModifiers_40() + [Theory] + [CombinatorialData] + public void MethodModifiers_40(bool isStatic) { + string declModifiers = isStatic ? "static " : ""; + var source1 = @" public interface I1 -{ +{ " + declModifiers + @" protected abstract void M1(); + +"; + if (!isStatic) + { + source1 += +@" public void M2() => M1(); +"; + } + else + { + source1 += +@" + public static void M2() where T : I1 + { + T.M1(); + } +"; + } + + source1 += +@" } public class Test2 : I1 -{ +{ " + declModifiers + @" void I1.M1() { } @@ -12083,22 +12235,75 @@ void I1.M1() @" class Test1 : Test2, I1 { + " + declModifiers + @" + public void M1() + { + System.Console.WriteLine(""Test1.M1""); + } +"; + if (!isStatic) + { + source2 += +@" static void Main() { I1 x = new Test1(); x.M2(); } +"; + } + else + { + source2 += +@" + static void Main() + { + Test(); + } - public void M1() + static void Test() where T : I1 { - System.Console.WriteLine(""Test1.M1""); + I1.M2(); } +"; + } + + source2 += +@" } "; + ValidateMethodModifiers_10_02(source1, source2, Accessibility.Protected, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: !isStatic ? + ExpectedDiagnostics( + // (5,17): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(5, 17) + ) : + ExpectedDiagnostics( + // (24,29): error CS8703: The modifier 'abstract' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. + // protected abstract void M1(); + Diagnostic(ErrorCode.ERR_InvalidModifierForLanguageVersion, "M1").WithArguments("abstract", "9.0", "preview").WithLocation(24, 29), + // (29,9): error CS8652: The feature 'static abstract members in interfaces' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // T.M1(); + Diagnostic(ErrorCode.ERR_FeatureInPreview, "T").WithArguments("static abstract members in interfaces").WithLocation(29, 9), + // (36,13): error CS8703: The modifier 'static' is not valid for this item in C# 9.0. Please use language version 'preview' or greater. + // void I1.M1() + Diagnostic(ErrorCode.ERR_InvalidModifierForLanguageVersion, "M1").WithArguments("static", "9.0", "preview").WithLocation(36, 13) + ), + expectedIn9AcrossAssemblyBoundaries: !isStatic ? + ExpectedDiagnostics( + // (5,17): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(5, 17) + ) : + ExpectedDiagnostics( + // (5,17): error CS8706: 'Test1.M1()' cannot implement interface member 'I1.M1()' in type 'Test1' because feature 'static abstract members in interfaces' is not available in C# 9.0. Please use language version 'preview' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_LanguageVersionDoesNotSupportInterfaceImplementationForMember, "M1").WithArguments("Test1.M1()", "I1.M1()", "Test1", "static abstract members in interfaces", "9.0", "preview").WithLocation(5, 17) + ), + expectedAcrossAssemblyBoundaries: Array.Empty(), + isStatic: isStatic ); } @@ -12138,9 +12343,9 @@ public void M1() } "; ValidateMethodModifiers_10_02(source1, source2, Accessibility.ProtectedOrInternal, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 22) + // (10,17): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(10, 17) ); } @@ -12179,10 +12384,18 @@ public virtual void M1() } } "; + ValidateMethodModifiers_10_02(source1, source2, Accessibility.ProtectedAndInternal, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (10,25): error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public virtual void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()", "9.0", "10.0").WithLocation(10, 25) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (10,25): error CS9044: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement an inaccessible member. + // public virtual void M1() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "M1").WithArguments("Test1", "I1.M1()", "Test1.M1()").WithLocation(10, 25) + ) ); } @@ -14477,29 +14690,47 @@ public int P1 "; ValidatePropertyModifiers_11_01(source1, source2, Accessibility.Internal, - new DiagnosticDescription[] { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 15) - }, - // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' - // class Test2 : I1 - Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(12, 9), + // (17,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(17, 9) + ), + expectedNoImplementation: ExpectedDiagnostics( + // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' + // class Test2 : I1 + Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (12,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(12, 9), + // (17,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(17, 9) + ) ); } private void ValidatePropertyModifiers_11_01(string source1, string source2, Accessibility accessibility, - DiagnosticDescription[] expected1, - params DiagnosticDescription[] expected2) + DiagnosticDescription[] expectedIn9, + params DiagnosticDescription[] expectedNoImplementation) + { + ValidatePropertyModifiers_11_01(source1, source2, accessibility, expectedIn9, expectedNoImplementation, expectedAcrossAssemblyBoundaries: Array.Empty()); + } + + private void ValidatePropertyModifiers_11_01(string source1, string source2, Accessibility accessibility, + DiagnosticDescription[] expectedIn9, + DiagnosticDescription[] expectedNoImplementation, + params DiagnosticDescription[] expectedAcrossAssemblyBoundaries) { var compilation1 = CreateCompilation(source2 + source1, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation1.VerifyDiagnostics(expected1); + compilation1.VerifyDiagnostics(expectedIn9); ValidatePropertyModifiers_11(compilation1.SourceModule, accessibility); @@ -14545,7 +14776,7 @@ class Test2 : I1 parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation3.VerifyDiagnostics(expected1); + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries.Length != 0 ? expectedAcrossAssemblyBoundaries : expectedIn9); ValidatePropertyModifiers_11(compilation3.SourceModule, accessibility); @@ -14553,10 +14784,18 @@ class Test2 : I1 parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : + + if (expectedAcrossAssemblyBoundaries.Length != 0) + { + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries); + } + else + { + CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"get_P1 set_P1", - verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidatePropertyModifiers_11(m, accessibility)).VerifyDiagnostics(); + verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidatePropertyModifiers_11(m, accessibility)).VerifyDiagnostics(); + } ValidatePropertyModifiers_11(compilation3.SourceModule, accessibility); @@ -14564,7 +14803,7 @@ class Test2 : I1 parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation5.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation5.VerifyDiagnostics(expected2); + compilation5.VerifyDiagnostics(expectedNoImplementation); ValidatePropertyNotImplemented_11(compilation5, "Test2"); } @@ -14662,23 +14901,34 @@ public virtual int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(11, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(11, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(16, 9) + ) ); } private void ValidatePropertyModifiers_11_02(string source1, string source2, - params DiagnosticDescription[] expected) + DiagnosticDescription[] expectedIn9, + params DiagnosticDescription[] expectedAcrossAssemblyBoundaries) { var compilation1 = CreateCompilation(source2 + source1, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation1.VerifyDiagnostics(expected); + compilation1.VerifyDiagnostics(expectedIn9); ValidatePropertyImplementation_11(compilation1.SourceModule); @@ -14705,7 +14955,7 @@ private void ValidatePropertyModifiers_11_02(string source1, string source2, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation3.VerifyDiagnostics(expected); + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries.Length != 0 ? expectedAcrossAssemblyBoundaries : expectedIn9); ValidatePropertyImplementation_11(compilation3.SourceModule); @@ -14713,10 +14963,18 @@ private void ValidatePropertyModifiers_11_02(string source1, string source2, parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : + + if (expectedAcrossAssemblyBoundaries.Length != 0) + { + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries); + } + else + { + CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"get_P1 set_P1", - verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidatePropertyImplementation_11(m)).VerifyDiagnostics(); + verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidatePropertyImplementation_11(m)).VerifyDiagnostics(); + } ValidatePropertyImplementation_11(compilation3.SourceModule); } @@ -14894,12 +15152,22 @@ public int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(11, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(11, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(16, 9) + ) ); } @@ -14961,12 +15229,22 @@ public virtual int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(11, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(11, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(16, 9) + ) ); } @@ -15033,12 +15311,22 @@ public override int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,29): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract int P1 {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(9, 29), + // (9,34): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract int P1 {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(9, 34) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,29): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // public abstract int P1 {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(9, 29), + // (9,34): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // public abstract int P1 {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(9, 34) + ) ); } @@ -15105,12 +15393,22 @@ public interface I2 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(11, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(11, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(16, 9) + ) ); } @@ -15330,23 +15628,34 @@ static void Main() "; ValidatePropertyModifiers_11_10(source1, source2, - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.set", "Test2.P1.set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.get", "Test2.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (6,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test2", "I1.P1.get", "Test2.P1.get", "9.0", "10.0").WithLocation(6, 9), + // (11,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test2", "I1.P1.set", "Test2.P1.set", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (6,9): error CS9044: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test2", "I1.P1.get", "Test2.P1.get").WithLocation(6, 9), + // (11,9): error CS9044: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test2", "I1.P1.set", "Test2.P1.set").WithLocation(11, 9) + ) ); } private void ValidatePropertyModifiers_11_10(string source1, string source2, - params DiagnosticDescription[] expected) + DiagnosticDescription[] expectedIn9, + params DiagnosticDescription[] expectedAcrossAssemblyBoundaries) { var compilation1 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); - compilation1.VerifyDiagnostics(expected); + compilation1.VerifyDiagnostics(expectedIn9); ValidatePropertyImplementationByBase_11(compilation1.SourceModule); @@ -15373,7 +15682,7 @@ private void ValidatePropertyModifiers_11_10(string source1, string source2, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); - compilation3.VerifyDiagnostics(expected); + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries.Length != 0 ? expectedAcrossAssemblyBoundaries : expectedIn9); ValidatePropertyImplementationByBase_11(compilation3.SourceModule); @@ -15381,10 +15690,17 @@ private void ValidatePropertyModifiers_11_10(string source1, string source2, parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : + if (expectedAcrossAssemblyBoundaries.Length != 0) + { + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries); + } + else + { + CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"get_P1 set_P1", - verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidatePropertyImplementationByBase_11(m)).VerifyDiagnostics(); + verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidatePropertyImplementationByBase_11(m)).VerifyDiagnostics(); + } ValidatePropertyImplementationByBase_11(compilation3.SourceModule); } @@ -15434,24 +15750,31 @@ static void Main() "; ValidatePropertyModifiers_11_11(source1, source2, - // (11,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.get", "Test2.P1.get", "9.0", "10.0").WithLocation(11, 22), - // (11,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.set", "Test2.P1.set", "9.0", "10.0").WithLocation(11, 22) + // (15,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test2", "I1.P1.get", "Test2.P1.get", "9.0", "10.0").WithLocation(15, 9), + // (20,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test2", "I1.P1.set", "Test2.P1.set", "9.0", "10.0").WithLocation(20, 9) ); } private void ValidatePropertyModifiers_11_11(string source1, string source2, - params DiagnosticDescription[] expected) + params DiagnosticDescription[] expectedIn9) + { + ValidatePropertyModifiers_11_11(source1, source2, expectedIn9, expectedAcrossAssemblyBoundaries: Array.Empty()); + } + + private void ValidatePropertyModifiers_11_11(string source1, string source2, + DiagnosticDescription[] expectedIn9, + params DiagnosticDescription[] expectedAcrossAssemblyBoundaries) { var compilation2 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp, assemblyName: "PropertyModifiers_11_11"); - compilation2.VerifyDiagnostics(expected); + compilation2.VerifyDiagnostics(expectedIn9); compilation2 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, @@ -15464,10 +15787,17 @@ private void ValidatePropertyModifiers_11_11(string source1, string source2, parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : + if (expectedAcrossAssemblyBoundaries.Length != 0) + { + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries); + } + else + { + CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"get_P1 set_P1", - verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidatePropertyImplementationByBase_11(m)).VerifyDiagnostics(); + verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidatePropertyImplementationByBase_11(m)).VerifyDiagnostics(); + } ValidatePropertyImplementationByBase_11(compilation3.SourceModule); } @@ -17921,19 +18251,31 @@ public int P1 } "; ValidatePropertyModifiers_23(source1, source2, Accessibility.Internal, Accessibility.Public, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(12, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (12,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(12, 9) + ) ); } - private void ValidatePropertyModifiers_23(string source1, string source2, Accessibility getAccess, Accessibility setAccess, params DiagnosticDescription[] expected) + private void ValidatePropertyModifiers_23(string source1, string source2, Accessibility getAccess, Accessibility setAccess, params DiagnosticDescription[] expectedIn9) + { + ValidatePropertyModifiers_23(source1, source2, getAccess, setAccess, expectedIn9, expectedAcrossAssemblyBoundaries: Array.Empty()); + } + + private void ValidatePropertyModifiers_23(string source1, string source2, Accessibility getAccess, Accessibility setAccess, DiagnosticDescription[] expectedIn9, params DiagnosticDescription[] expectedAcrossAssemblyBoundaries) { var compilation1 = CreateCompilation(source2 + source1, options: TestOptions.DebugExe.WithMetadataImportOptions(MetadataImportOptions.All), parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation1.VerifyDiagnostics(expected); + compilation1.VerifyDiagnostics(expectedIn9); Validate1(compilation1.SourceModule); @@ -17971,7 +18313,7 @@ void Validate1(ModuleSymbol m) parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation3.VerifyDiagnostics(expected); + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries.Length != 0 ? expectedAcrossAssemblyBoundaries : expectedIn9); Validate1(compilation3.SourceModule); @@ -17980,10 +18322,18 @@ void Validate1(ModuleSymbol m) parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : + + if (expectedAcrossAssemblyBoundaries.Length != 0) + { + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries); + } + else + { + CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"get_P1 set_P1", - verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => Validate1(m)).VerifyDiagnostics(); + verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => Validate1(m)).VerifyDiagnostics(); + } Validate1(compilation3.SourceModule); } @@ -18030,9 +18380,16 @@ public virtual int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(11, 9) + ) ); } @@ -18141,9 +18498,16 @@ public int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(11, 9) + ) ); } @@ -18205,9 +18569,16 @@ public virtual int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(11, 9) + ) ); } @@ -18274,9 +18645,16 @@ public override int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,29): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract int P1 {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(9, 29) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,29): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // public abstract int P1 {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(9, 29) + ) ); } @@ -18343,9 +18721,16 @@ public interface I2 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(11, 9) + ) ); } @@ -18500,9 +18885,16 @@ static void Main() "; ValidatePropertyModifiers_11_10(source1, source2, - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.get", "Test2.P1.get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (6,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test2", "I1.P1.get", "Test2.P1.get", "9.0", "10.0").WithLocation(6, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (6,9): error CS9044: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test2", "I1.P1.get", "Test2.P1.get").WithLocation(6, 9) + ) ); } @@ -18550,9 +18942,9 @@ static void Main() "; ValidatePropertyModifiers_11_11(source1, source2, - // (11,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.get", "Test2.P1.get", "9.0", "10.0").WithLocation(11, 22) + // (15,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.get'. 'Test2.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test2", "I1.P1.get", "Test2.P1.get", "9.0", "10.0").WithLocation(15, 9) ); } @@ -18597,9 +18989,16 @@ public int P1 } "; ValidatePropertyModifiers_23(source1, source2, Accessibility.Public, Accessibility.Internal, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (17,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(17, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (17,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(17, 9) + ) ); } @@ -18644,9 +19043,16 @@ public virtual int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(16, 9) + ) ); } @@ -18755,9 +19161,16 @@ public int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(16, 9) + ) ); } @@ -18819,9 +19232,16 @@ public virtual int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(16, 9) + ) ); } @@ -18888,9 +19308,16 @@ public override int P1 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,34): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract int P1 {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(9, 34) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,34): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // public abstract int P1 {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(9, 34) + ) ); } @@ -18957,9 +19384,16 @@ public interface I2 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(16, 9) + ) ); } @@ -19114,9 +19548,16 @@ static void Main() "; ValidatePropertyModifiers_11_10(source1, source2, - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.set", "Test2.P1.set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test2", "I1.P1.set", "Test2.P1.set", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test2", "I1.P1.set", "Test2.P1.set").WithLocation(11, 9) + ) ); } @@ -19164,9 +19605,9 @@ static void Main() "; ValidatePropertyModifiers_11_11(source1, source2, - // (11,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.set", "Test2.P1.set", "9.0", "10.0").WithLocation(11, 22) + // (20,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.set'. 'Test2.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test2", "I1.P1.set", "Test2.P1.set", "9.0", "10.0").WithLocation(20, 9) ); } @@ -19968,12 +20409,12 @@ public int P1 ValidatePropertyModifiers_11_01(source1, source2, Accessibility.Protected, new DiagnosticDescription[] { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 15) + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(12, 9), + // (17,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(17, 9) }, // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' // class Test2 : I1 @@ -20024,12 +20465,12 @@ public int P1 ValidatePropertyModifiers_11_01(source1, source2, Accessibility.ProtectedOrInternal, new DiagnosticDescription[] { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 15) + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(12, 9), + // (17,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(17, 9) }, // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' // class Test2 : I1 @@ -20079,17 +20520,27 @@ public int P1 "; ValidatePropertyModifiers_11_01(source1, source2, Accessibility.ProtectedAndInternal, - new DiagnosticDescription[] { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 15) - }, - // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' - // class Test2 : I1 - Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(12, 9), + // (17,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(17, 9) + ), + expectedNoImplementation: ExpectedDiagnostics( + // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' + // class Test2 : I1 + Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (12,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get").WithLocation(12, 9), + // (17,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(17, 9) + ) ); } @@ -20134,9 +20585,9 @@ public int P1 } "; ValidatePropertyModifiers_23(source1, source2, Accessibility.Protected, Accessibility.Public, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 15) + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(12, 9) ); } @@ -20181,9 +20632,9 @@ public int P1 } "; ValidatePropertyModifiers_23(source1, source2, Accessibility.ProtectedOrInternal, Accessibility.Public, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(2, 15) + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.get'. 'Test1.P1.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.P1.get", "Test1.P1.get", "9.0", "10.0").WithLocation(12, 9) ); } @@ -20228,9 +20679,16 @@ public int P1 } "; ValidatePropertyModifiers_23(source1, source2, Accessibility.Public, Accessibility.ProtectedAndInternal, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (17,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set", "9.0", "10.0").WithLocation(17, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (17,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.set'. 'Test1.P1.set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.P1.set", "Test1.P1.set").WithLocation(17, 9) + ) ); } @@ -22051,17 +22509,27 @@ public int this[int x] "; ValidatePropertyModifiers_11_01(source1, source2, Accessibility.Internal, - new DiagnosticDescription[] { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 15) - }, - // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.this[int]' - // class Test2 : I1 - Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.this[int]") + expectedIn9: ExpectedDiagnostics( + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(12, 9), + // (17,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(17, 9) + ), + expectedNoImplementation: ExpectedDiagnostics( + // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.this[int]' + // class Test2 : I1 + Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.this[int]") + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (12,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(12, 9), + // (17,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(17, 9) + ) ); } @@ -22106,12 +22574,22 @@ public virtual int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(11, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(11, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(16, 9) + ) ); } @@ -22220,12 +22698,22 @@ public int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(11, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(11, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(16, 9) + ) ); } @@ -22287,12 +22775,22 @@ public virtual int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(11, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(11, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(16, 9) + ) ); } @@ -22359,12 +22857,22 @@ public override int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,38): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract int this[int x] {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(9, 38), + // (9,43): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract int this[int x] {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(9, 43) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,38): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // public abstract int this[int x] {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(9, 38), + // (9,43): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // public abstract int this[int x] {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(9, 43) + ) ); } @@ -22431,12 +22939,22 @@ public interface I2 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(11, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(11, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(16, 9) + ) ); } @@ -22591,12 +23109,22 @@ static void Main() "; ValidatePropertyModifiers_11_10(source1, source2, - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (6,9): error CS8704: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get", "9.0", "10.0").WithLocation(6, 9), + // (11,9): error CS8704: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (6,9): error CS9044: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get").WithLocation(6, 9), + // (11,9): error CS9044: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set").WithLocation(11, 9) + ) ); } @@ -22644,12 +23172,12 @@ static void Main() "; ValidatePropertyModifiers_11_11(source1, source2, - // (11,22): error CS8704: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get", "9.0", "10.0").WithLocation(11, 22), - // (11,22): error CS8704: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set", "9.0", "10.0").WithLocation(11, 22) + // (15,9): error CS8704: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get", "9.0", "10.0").WithLocation(15, 9), + // (20,9): error CS8704: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set", "9.0", "10.0").WithLocation(20, 9) ); } @@ -24451,9 +24979,16 @@ public int this[int x] } "; ValidatePropertyModifiers_23(source1, source2, Accessibility.Internal, Accessibility.Public, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(12, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (12,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(12, 9) + ) ); } @@ -24498,9 +25033,16 @@ public virtual int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(11, 9) + ) ); } @@ -24609,9 +25151,16 @@ public int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(11, 9) + ) ); } @@ -24673,9 +25222,16 @@ public virtual int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(11, 9) + ) ); } @@ -24742,9 +25298,16 @@ public override int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,38): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract int this[int x] {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(9, 38) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,38): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // public abstract int this[int x] {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(9, 38) + ) ); } @@ -24811,9 +25374,16 @@ public interface I2 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].get'. 'Test1.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test1", "I1.this[int].get", "Test1.this[int].get").WithLocation(11, 9) + ) ); } @@ -24968,9 +25538,16 @@ static void Main() "; ValidatePropertyModifiers_11_10(source1, source2, - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (6,9): error CS8704: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get", "9.0", "10.0").WithLocation(6, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (6,9): error CS9044: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement an inaccessible member. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get").WithLocation(6, 9) + ) ); } @@ -25018,9 +25595,9 @@ static void Main() "; ValidatePropertyModifiers_11_11(source1, source2, - // (11,22): error CS8704: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get", "9.0", "10.0").WithLocation(11, 22) + // (15,9): error CS8704: 'Test2' does not implement interface member 'I1.this[int].get'. 'Test2.this[int].get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // get + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("Test2", "I1.this[int].get", "Test2.this[int].get", "9.0", "10.0").WithLocation(15, 9) ); } @@ -25065,9 +25642,16 @@ public int this[int x] } "; ValidatePropertyModifiers_23(source1, source2, Accessibility.Public, Accessibility.Internal, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (17,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(17, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (17,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(17, 9) + ) ); } @@ -25112,9 +25696,16 @@ public virtual int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(16, 9) + ) ); } @@ -25223,9 +25814,16 @@ public int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(16, 9) + ) ); } @@ -25287,9 +25885,16 @@ public virtual int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(16, 9) + ) ); } @@ -25356,9 +25961,16 @@ public override int this[int x] "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,43): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract int this[int x] {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(9, 43) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,43): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // public abstract int this[int x] {get; set;} + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(9, 43) + ) ); } @@ -25425,9 +26037,16 @@ public interface I2 "; ValidatePropertyModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set", "9.0", "10.0").WithLocation(16, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.this[int].set'. 'Test1.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test1", "I1.this[int].set", "Test1.this[int].set").WithLocation(16, 9) + ) ); } @@ -25582,9 +26201,16 @@ static void Main() "; ValidatePropertyModifiers_11_10(source1, source2, - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set", "9.0", "10.0").WithLocation(11, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement an inaccessible member. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set").WithLocation(11, 9) + ) ); } @@ -25632,9 +26258,9 @@ static void Main() "; ValidatePropertyModifiers_11_11(source1, source2, - // (11,22): error CS8704: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set", "9.0", "10.0").WithLocation(11, 22) + // (20,9): error CS8704: 'Test2' does not implement interface member 'I1.this[int].set'. 'Test2.this[int].set' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // set + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "set").WithArguments("Test2", "I1.this[int].set", "Test2.this[int].set", "9.0", "10.0").WithLocation(20, 9) ); } @@ -27576,28 +28202,42 @@ public event System.Action P1 "; ValidateEventModifiers_11(source1, source2, Accessibility.Internal, - new DiagnosticDescription[] - { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(2, 15) - }, - // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' - // class Test2 : I1 - Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(12, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(16, 9) + ), + expectedNoImplementation: ExpectedDiagnostics( + // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' + // class Test2 : I1 + Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (12,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement an inaccessible member. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add").WithLocation(12, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement an inaccessible member. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove").WithLocation(16, 9) + ) ); } - private void ValidateEventModifiers_11(string source1, string source2, Accessibility accessibility, DiagnosticDescription[] expected1, params DiagnosticDescription[] expected2) + private void ValidateEventModifiers_11(string source1, string source2, Accessibility accessibility, DiagnosticDescription[] expectedIn9, params DiagnosticDescription[] expectedNoImplementation) + { + ValidateEventModifiers_11(source1, source2, accessibility, expectedIn9, expectedAcrossAssemblyBoundaries: Array.Empty(), expectedNoImplementation); + } + + private void ValidateEventModifiers_11(string source1, string source2, Accessibility accessibility, DiagnosticDescription[] expectedIn9, DiagnosticDescription[] expectedAcrossAssemblyBoundaries, params DiagnosticDescription[] expectedNoImplementation) { var compilation1 = CreateCompilation(source2 + source1, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation1.VerifyDiagnostics(expected1); + compilation1.VerifyDiagnostics(expectedIn9); Validate1(compilation1.SourceModule); @@ -27680,7 +28320,7 @@ class Test2 : I1 parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation3.VerifyDiagnostics(expected1); + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries.Length != 0 ? expectedAcrossAssemblyBoundaries : expectedIn9); Validate1(compilation3.SourceModule); @@ -27688,10 +28328,18 @@ class Test2 : I1 parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation3.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : + + if (expectedAcrossAssemblyBoundaries.Length != 0) + { + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries); + } + else + { + CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"get_P1 set_P1", - verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => Validate1(m)).VerifyDiagnostics(); + verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => Validate1(m)).VerifyDiagnostics(); + } Validate1(compilation3.SourceModule); @@ -27699,7 +28347,7 @@ class Test2 : I1 parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); Assert.True(compilation5.Assembly.RuntimeSupportsDefaultInterfaceImplementation); - compilation5.VerifyDiagnostics(expected2); + compilation5.VerifyDiagnostics(expectedNoImplementation); ValidateEventNotImplemented_11(compilation5, "Test2"); } @@ -27759,23 +28407,34 @@ public virtual event System.Action P1 "; ValidateEventModifiers_11_02(source1, source2, - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(11, 9), + // (15,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(15, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement an inaccessible member. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add").WithLocation(11, 9), + // (15,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement an inaccessible member. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove").WithLocation(15, 9) + ) ); } private void ValidateEventModifiers_11_02(string source1, string source2, - params DiagnosticDescription[] expected) + DiagnosticDescription[] expectedIn9, + params DiagnosticDescription[] expectedAcrossAssemblyBoundaries) { var compilation1 = CreateCompilation(source2 + source1, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); - compilation1.VerifyDiagnostics(expected); + compilation1.VerifyDiagnostics(expectedIn9); ValidateEventImplementation_11(compilation1.SourceModule); @@ -27802,7 +28461,7 @@ private void ValidateEventModifiers_11_02(string source1, string source2, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); - compilation3.VerifyDiagnostics(expected); + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries.Length != 0 ? expectedAcrossAssemblyBoundaries : expectedIn9); ValidateEventImplementation_11(compilation3.SourceModule); @@ -27810,10 +28469,17 @@ private void ValidateEventModifiers_11_02(string source1, string source2, parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : + if (expectedAcrossAssemblyBoundaries.Length != 0) + { + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries); + } + else + { + CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"get_P1 set_P1", - verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateEventImplementation_11(m)).VerifyDiagnostics(); + verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateEventImplementation_11(m)).VerifyDiagnostics(); + } ValidateEventImplementation_11(compilation3.SourceModule); } @@ -27991,12 +28657,22 @@ public event System.Action P1 "; ValidateEventModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(11, 9), + // (15,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(15, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement an inaccessible member. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add").WithLocation(11, 9), + // (15,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement an inaccessible member. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove").WithLocation(15, 9) + ) ); } @@ -28059,12 +28735,22 @@ public virtual event System.Action P1 "; ValidateEventModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(11, 9), + // (15,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(15, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement an inaccessible member. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add").WithLocation(11, 9), + // (15,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement an inaccessible member. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove").WithLocation(15, 9) + ) ); } @@ -28133,12 +28819,22 @@ public override event System.Action P1 "; ValidateEventModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (9,41): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract event System.Action P1; + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "P1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(9, 41), + // (9,41): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public abstract event System.Action P1; + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "P1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(9, 41) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (9,41): error CS9044: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement an inaccessible member. + // public abstract event System.Action P1; + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "P1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add").WithLocation(9, 41), + // (9,41): error CS9044: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement an inaccessible member. + // public abstract event System.Action P1; + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "P1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove").WithLocation(9, 41) + ) ); } @@ -28206,12 +28902,22 @@ public interface I2 "; ValidateEventModifiers_11_02(source1, source2, - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : Test2, I1, I2 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (11,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(11, 9), + // (15,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(15, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (11,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement an inaccessible member. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add").WithLocation(11, 9), + // (15,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement an inaccessible member. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove").WithLocation(15, 9) + ) ); } @@ -28435,23 +29141,34 @@ static void Main() "; ValidateEventModifiers_11_10(source1, source2, - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.remove'. 'Test2.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.remove", "Test2.P1.remove", "9.0", "10.0").WithLocation(2, 22), - // (2,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.add'. 'Test2.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.add", "Test2.P1.add", "9.0", "10.0").WithLocation(2, 22) + expectedIn9: ExpectedDiagnostics( + // (6,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.add'. 'Test2.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test2", "I1.P1.add", "Test2.P1.add", "9.0", "10.0").WithLocation(6, 9), + // (10,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.remove'. 'Test2.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test2", "I1.P1.remove", "Test2.P1.remove", "9.0", "10.0").WithLocation(10, 9) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (6,9): error CS9044: 'Test2' does not implement interface member 'I1.P1.add'. 'Test2.P1.add' cannot implicitly implement an inaccessible member. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "add").WithArguments("Test2", "I1.P1.add", "Test2.P1.add").WithLocation(6, 9), + // (10,9): error CS9044: 'Test2' does not implement interface member 'I1.P1.remove'. 'Test2.P1.remove' cannot implicitly implement an inaccessible member. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "remove").WithArguments("Test2", "I1.P1.remove", "Test2.P1.remove").WithLocation(10, 9) + ) ); } private void ValidateEventModifiers_11_10(string source1, string source2, - params DiagnosticDescription[] expected) + DiagnosticDescription[] expectedIn9, + params DiagnosticDescription[] expectedAcrossAssemblyBoundaries) { var compilation1 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); - compilation1.VerifyDiagnostics(expected); + compilation1.VerifyDiagnostics(expectedIn9); ValidateEventImplementationByBase_11(compilation1.SourceModule); @@ -28478,7 +29195,7 @@ private void ValidateEventModifiers_11_10(string source1, string source2, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); - compilation3.VerifyDiagnostics(expected); + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries.Length != 0 ? expectedAcrossAssemblyBoundaries : expectedIn9); ValidateEventImplementationByBase_11(compilation3.SourceModule); @@ -28486,10 +29203,17 @@ private void ValidateEventModifiers_11_10(string source1, string source2, parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); - CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : + if (expectedAcrossAssemblyBoundaries.Length != 0) + { + compilation3.VerifyDiagnostics(expectedAcrossAssemblyBoundaries); + } + else + { + CompileAndVerify(compilation3, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"get_P1 set_P1", - verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateEventImplementationByBase_11(m)).VerifyDiagnostics(); + verify: VerifyOnMonoOrCoreClr, symbolValidator: (m) => ValidateEventImplementationByBase_11(m)).VerifyDiagnostics(); + } ValidateEventImplementationByBase_11(compilation3.SourceModule); } @@ -28539,12 +29263,12 @@ static void Main() "; ValidateEventModifiers_11_11(source1, source2, - // (12,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.remove'. 'Test2.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.remove", "Test2.P1.remove", "9.0", "10.0").WithLocation(12, 22), - // (12,22): error CS8704: 'Test2' does not implement interface member 'I1.P1.add'. 'Test2.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class Test2 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test2", "I1.P1.add", "Test2.P1.add", "9.0", "10.0").WithLocation(12, 22) + // (16,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.add'. 'Test2.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test2", "I1.P1.add", "Test2.P1.add", "9.0", "10.0").WithLocation(16, 9), + // (20,9): error CS8704: 'Test2' does not implement interface member 'I1.P1.remove'. 'Test2.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test2", "I1.P1.remove", "Test2.P1.remove", "9.0", "10.0").WithLocation(20, 9) ); } @@ -30396,12 +31120,12 @@ public event System.Action P1 ValidateEventModifiers_11(source1, source2, Accessibility.Protected, new DiagnosticDescription[] { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(2, 15) + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(12, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(16, 9) }, // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' // class Test2 : I1 @@ -30451,18 +31175,19 @@ public event System.Action P1 "; ValidateEventModifiers_11(source1, source2, Accessibility.ProtectedOrInternal, - new DiagnosticDescription[] - { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(2, 15) - }, - // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' - // class Test2 : I1 - Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(12, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(16, 9) + ), + expectedNoImplementation: ExpectedDiagnostics( + // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' + // class Test2 : I1 + Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + ) ); } @@ -30508,18 +31233,27 @@ public event System.Action P1 "; ValidateEventModifiers_11(source1, source2, Accessibility.ProtectedAndInternal, - new DiagnosticDescription[] - { - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(2, 15), - // (2,15): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // class Test1 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(2, 15) - }, - // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' - // class Test2 : I1 - Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + expectedIn9: ExpectedDiagnostics( + // (12,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add", "9.0", "10.0").WithLocation(12, 9), + // (16,9): error CS8704: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove", "9.0", "10.0").WithLocation(16, 9) + ), + expectedNoImplementation: ExpectedDiagnostics( + // (2,15): error CS0535: 'Test2' does not implement interface member 'I1.P1' + // class Test2 : I1 + Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("Test2", "I1.P1").WithLocation(2, 15) + ), + expectedAcrossAssemblyBoundaries: ExpectedDiagnostics( + // (12,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.add'. 'Test1.P1.add' cannot implicitly implement an inaccessible member. + // add + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "add").WithArguments("Test1", "I1.P1.add", "Test1.P1.add").WithLocation(12, 9), + // (16,9): error CS9044: 'Test1' does not implement interface member 'I1.P1.remove'. 'Test1.P1.remove' cannot implicitly implement an inaccessible member. + // remove + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "remove").WithArguments("Test1", "I1.P1.remove", "Test1.P1.remove").WithLocation(16, 9) + ) ); } @@ -61579,9 +62313,9 @@ static void Main() Assert.Equal("System.String C0.M()", test.FindImplementationForInterfaceMember(i1M).ToTestDisplayString()); compilation1.VerifyDiagnostics( - // (15,19): error CS8704: 'C0' does not implement interface member 'I1.M()'. 'C0.M()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class C0 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("C0", "I1.M()", "C0.M()", "9.0", "10.0").WithLocation(15, 19) + // (17,27): error CS8704: 'C0' does not implement interface member 'I1.M()'. 'C0.M()' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public virtual string M() + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "M").WithArguments("C0", "I1.M()", "C0.M()", "9.0", "10.0").WithLocation(17, 27) ); compilation1 = CreateCompilation(source1, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular, targetFramework: TargetFramework.NetCoreApp); @@ -61615,9 +62349,9 @@ public class C0 : I1 parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); compilation1.VerifyDiagnostics( - // (7,19): error CS8704: 'C0' does not implement interface member 'I1.get_P()'. 'C0.P.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. - // public class C0 : I1 - Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "I1").WithArguments("C0", "I1.get_P()", "C0.P.get", "9.0", "10.0").WithLocation(7, 19), + // (9,28): error CS8704: 'C0' does not implement interface member 'I1.get_P()'. 'C0.P.get' cannot implicitly implement a non-public member in C# 9.0. Please use language version '10.0' or greater. + // public virtual int P { get; } + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, "get").WithArguments("C0", "I1.get_P()", "C0.P.get", "9.0", "10.0").WithLocation(9, 28), // (9,28): error CS0686: Accessor 'C0.P.get' cannot implement interface member 'I1.get_P()' for type 'C0'. Use an explicit interface implementation. // public virtual int P { get; } Diagnostic(ErrorCode.ERR_AccessorImplementingMethod, "get").WithArguments("C0.P.get", "I1.get_P()", "C0").WithLocation(9, 28) diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs index 3a8d4ed9bd809..20d4478936bb2 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs @@ -6336,6 +6336,528 @@ void Test(C7 y) } } +class C8 +{ + void M() where T8 : I1 {} + + void Test(C8 x) + { + x.M(); + } +} +"; + var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework, + references: new[] { compilation1.ToMetadataReference() }); + + DiagnosticDescription[] expected; + + if (!isVirtual) + { + expected = new[] { + // (4,22): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C1 x) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("I2", "I1.M01()").WithLocation(4, 22), + // (15,11): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I2", "I1.M01()").WithLocation(15, 11), + // (21,22): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C3 x, C3 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("I2", "I1.M01()").WithLocation(21, 22), + // (21,32): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C3 x, C3 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I3", "I1.M01()").WithLocation(21, 32), + // (32,11): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I2", "I1.M01()").WithLocation(32, 11), + // (33,11): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I3", "I1.M01()").WithLocation(33, 11), + // (39,22): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C5 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I3", "I1.M01()").WithLocation(39, 22), + // (50,11): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I3", "I1.M01()").WithLocation(50, 11), + // (56,22): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C7 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I1", "I1.M01()").WithLocation(56, 22), + // (67,11): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I1", "I1.M01()").WithLocation(67, 11) + }; + } + else + { + expected = Array.Empty(); + } + + compilation2.VerifyDiagnostics(expected); + + compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework, + references: new[] { compilation1.EmitToImageReference() }); + + compilation2.VerifyDiagnostics(expected); + } + + [Theory] + [CombinatorialData] + public void ConstraintChecks_02(bool isVirtual) + { + var (modifier, body) = GetModifierAndBody(isVirtual); + + var source1 = +@" +public interface I1 +{ + " + modifier + @" static void M01()" + body + @" +} + +public class C : I1 +{ + public static void M01() {} +} + +public struct S : I1 +{ + public static void M01() {} +} +"; + var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework); + + var source2 = +@" +class C1 where T1 : I1 +{ + void Test(C1 x, C1 y, C1 z) + { + } +} + +class C2 +{ + public void M(C2 x) where T2 : I1 + { + x.M(x); + } + + void Test(C2 x) + { + x.M(x); + x.M(x); + } +} + +class C3 where T3 : I1 +{ + void Test(C1 z) + { + } +} + +class C4 +{ + void M(C2 x) where T4 : I1 + { + x.M(x); + } +} + +class C5 +{ + internal virtual void M() where U5 : T5 { } +} + +class C6 : C5 +{ + internal override void M() { base.M(); } +} +"; + var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework, + references: new[] { compilation1.ToMetadataReference() }); + + if (isVirtual) + { + compilation2.VerifyEmitDiagnostics(); + } + else + { + compilation2.VerifyEmitDiagnostics( + // (43,7): error CS8920: The interface 'I1' cannot be used as type argumen. Member 'I1.M01()' does not have a most specific implementation in the interface. + // class C6 : C5 + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "C6").WithArguments("I1", "I1.M01()").WithLocation(43, 7) + ); + } + + compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework, + references: new[] { compilation1.EmitToImageReference() }); + + if (isVirtual) + { + compilation2.VerifyEmitDiagnostics(); + } + else + { + compilation2.VerifyEmitDiagnostics( + // (43,7): error CS8920: The interface 'I1' cannot be used as type argumen. Member 'I1.M01()' does not have a most specific implementation in the interface. + // class C6 : C5 + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "C6").WithArguments("I1", "I1.M01()").WithLocation(43, 7) + ); + } + } + + [Fact] + public void ConstraintChecks_03() + { + var source1 = +@" +public interface I1 +{ + abstract static void M01(); +} + +public interface I2 : I1 +{ + static void I1.M01() {} +} + +public interface I3 : I2 +{ +} +"; + var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework); + + var source2 = +@" +class C1 where T1 : I1 +{ + void Test(C1 x) + { + } +} + +class C2 +{ + void M() where T2 : I1 {} + + void Test(C2 x) + { + x.M(); + } +} + +class C3 where T3 : I2 +{ + void Test(C3 x, C3 y) + { + } +} + +class C4 +{ + void M() where T4 : I2 {} + + void Test(C4 x) + { + x.M(); + x.M(); + } +} + +class C5 where T5 : I3 +{ + void Test(C5 y) + { + } +} + +class C6 +{ + void M() where T6 : I3 {} + + void Test(C6 x) + { + x.M(); + } +} + +class C7 where T7 : I1 +{ + void Test(C7 y) + { + } +} + +class C8 +{ + void M() where T8 : I1 {} + + void Test(C8 x) + { + x.M(); + } +} +"; + var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework, + references: new[] { compilation1.ToMetadataReference() }); + + var expected = new[] { + // (56,22): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C7 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I1", "I1.M01()").WithLocation(56, 22), + // (67,11): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I1", "I1.M01()").WithLocation(67, 11) + }; + + compilation2.VerifyDiagnostics(expected); + + compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework, + references: new[] { compilation1.EmitToImageReference() }); + + compilation2.VerifyDiagnostics(expected); + } + + [Fact] + public void ConstraintChecks_04() + { + var source1 = +@" +public interface I1 +{ + virtual static void M01(){} +} + +public interface I2 : I1 +{ + abstract static void I1.M01(); +} + +public interface I3 : I2 +{ +} +"; + var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework); + + var source2 = +@" +class C1 where T1 : I1 +{ + void Test(C1 x) + { + } +} + +class C2 +{ + void M() where T2 : I1 {} + + void Test(C2 x) + { + x.M(); + } +} + +class C3 where T3 : I2 +{ + void Test(C3 x, C3 y) + { + } +} + +class C4 +{ + void M() where T4 : I2 {} + + void Test(C4 x) + { + x.M(); + x.M(); + } +} + +class C5 where T5 : I3 +{ + void Test(C5 y) + { + } +} + +class C6 +{ + void M() where T6 : I3 {} + + void Test(C6 x) + { + x.M(); + } +} + +class C7 where T7 : I1 +{ + void Test(C7 y) + { + } +} + +class C8 +{ + void M() where T8 : I1 {} + + void Test(C8 x) + { + x.M(); + } +} +"; + var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework, + references: new[] { compilation1.ToMetadataReference() }); + + var expected = new[] { + // (4,22): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C1 x) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("I2", "I1.M01()").WithLocation(4, 22), + // (15,11): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I2", "I1.M01()").WithLocation(15, 11), + // (21,22): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C3 x, C3 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("I2", "I1.M01()").WithLocation(21, 22), + // (21,32): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C3 x, C3 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I3", "I1.M01()").WithLocation(21, 32), + // (32,11): error CS8920: The interface 'I2' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I2", "I1.M01()").WithLocation(32, 11), + // (33,11): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I3", "I1.M01()").WithLocation(33, 11), + // (39,22): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C5 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I3", "I1.M01()").WithLocation(39, 22), + // (50,11): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I3", "I1.M01()").WithLocation(50, 11) + }; + + compilation2.VerifyDiagnostics(expected); + + compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework, + references: new[] { compilation1.EmitToImageReference() }); + + compilation2.VerifyDiagnostics(expected); + } + + [Fact] + public void ConstraintChecks_05() + { + var source1 = +@" +public interface I1 +{ + virtual static void M01(){} +} + +public interface I2 : I1 +{ + static void I1.M01(){} +} + +public interface I4 : I1 +{ + abstract static void I1.M01(); +} + +public interface I3 : I2, I4 +{ +} +"; + var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework); + + var source2 = +@" +class C1 where T1 : I1 +{ + void Test(C1 x) + { + } +} + +class C2 +{ + void M() where T2 : I1 {} + + void Test(C2 x) + { + x.M(); + } +} + +class C3 where T3 : I2 +{ + void Test(C3 x, C3 y) + { + } +} + +class C4 +{ + void M() where T4 : I2 {} + + void Test(C4 x) + { + x.M(); + x.M(); + } +} + +class C5 where T5 : I3 +{ + void Test(C5 y) + { + } +} + +class C6 +{ + void M() where T6 : I3 {} + + void Test(C6 x) + { + x.M(); + } +} + +class C7 where T7 : I1 +{ + void Test(C7 y) + { + } +} + class C8 { void M() where T8 : I1 {} @@ -6352,37 +6874,19 @@ void Test(C8 x) references: new[] { compilation1.ToMetadataReference() }); var expected = new[] { - // (4,22): error CS8920: The interface 'I2' cannot be used as type parameter 'T1' in the generic type or method 'C1'. The constraint interface 'I1' or its base interface has static abstract or virtual members. - // void Test(C1 x) - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("C1", "I1", "T1", "I2").WithLocation(4, 22), - // (15,11): error CS8920: The interface 'I2' cannot be used as type parameter 'T2' in the generic type or method 'C2.M()'. The constraint interface 'I1' or its base interface has static abstract or virtual members. - // x.M(); - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("C2.M()", "I1", "T2", "I2").WithLocation(15, 11), - // (21,22): error CS8920: The interface 'I2' cannot be used as type parameter 'T3' in the generic type or method 'C3'. The constraint interface 'I2' or its base interface has static abstract or virtual members. - // void Test(C3 x, C3 y) - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("C3", "I2", "T3", "I2").WithLocation(21, 22), - // (21,32): error CS8920: The interface 'I3' cannot be used as type parameter 'T3' in the generic type or method 'C3'. The constraint interface 'I2' or its base interface has static abstract or virtual members. + // (21,32): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. // void Test(C3 x, C3 y) - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("C3", "I2", "T3", "I3").WithLocation(21, 32), - // (32,11): error CS8920: The interface 'I2' cannot be used as type parameter 'T4' in the generic type or method 'C4.M()'. The constraint interface 'I2' or its base interface has static abstract or virtual members. - // x.M(); - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("C4.M()", "I2", "T4", "I2").WithLocation(32, 11), - // (33,11): error CS8920: The interface 'I3' cannot be used as type parameter 'T4' in the generic type or method 'C4.M()'. The constraint interface 'I2' or its base interface has static abstract or virtual members. + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I3", "I1.M01()").WithLocation(21, 32), + // (33,11): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. // x.M(); - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("C4.M()", "I2", "T4", "I3").WithLocation(33, 11), - // (39,22): error CS8920: The interface 'I3' cannot be used as type parameter 'T5' in the generic type or method 'C5'. The constraint interface 'I3' or its base interface has static abstract or virtual members. + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I3", "I1.M01()").WithLocation(33, 11), + // (39,22): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. // void Test(C5 y) - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("C5", "I3", "T5", "I3").WithLocation(39, 22), - // (50,11): error CS8920: The interface 'I3' cannot be used as type parameter 'T6' in the generic type or method 'C6.M()'. The constraint interface 'I3' or its base interface has static abstract or virtual members. + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I3", "I1.M01()").WithLocation(39, 22), + // (50,11): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. // x.M(); - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("C6.M()", "I3", "T6", "I3").WithLocation(50, 11), - // (56,22): error CS8920: The interface 'I1' cannot be used as type parameter 'T7' in the generic type or method 'C7'. The constraint interface 'I1' or its base interface has static abstract or virtual members. - // void Test(C7 y) - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("C7", "I1", "T7", "I1").WithLocation(56, 22), - // (67,11): error CS8920: The interface 'I1' cannot be used as type parameter 'T8' in the generic type or method 'C8.M()'. The constraint interface 'I1' or its base interface has static abstract or virtual members. - // x.M(); - Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("C8.M()", "I1", "T8", "I1").WithLocation(67, 11) - }; + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I3", "I1.M01()").WithLocation(50, 11) + }; compilation2.VerifyDiagnostics(expected); @@ -6394,27 +6898,28 @@ void Test(C8 x) compilation2.VerifyDiagnostics(expected); } - [Theory] - [CombinatorialData] - public void ConstraintChecks_02(bool isVirtual) + [Fact] + public void ConstraintChecks_06() { - var (modifier, body) = GetModifierAndBody(isVirtual); - var source1 = @" public interface I1 { - " + modifier + @" static void M01()" + body + @" + virtual static void M01(){} } -public class C : I1 +public interface I2 : I1 { - public static void M01() {} + static void I1.M01(){} } -public struct S : I1 +public interface I4 : I1 +{ + static void I1.M01(){} +} + +public interface I3 : I2, I4 { - public static void M01() {} } "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, @@ -6425,48 +6930,71 @@ public static void M01() {} @" class C1 where T1 : I1 { - void Test(C1 x, C1 y, C1 z) + void Test(C1 x) { } } class C2 { - public void M(C2 x) where T2 : I1 - { - x.M(x); - } + void M() where T2 : I1 {} void Test(C2 x) { - x.M(x); - x.M(x); + x.M(); } } -class C3 where T3 : I1 +class C3 where T3 : I2 { - void Test(C1 z) + void Test(C3 x, C3 y) { } } class C4 { - void M(C2 x) where T4 : I1 + void M() where T4 : I2 {} + + void Test(C4 x) { - x.M(x); + x.M(); + x.M(); } } -class C5 +class C5 where T5 : I3 { - internal virtual void M() where U5 : T5 { } + void Test(C5 y) + { + } } -class C6 : C5 +class C6 { - internal override void M() { base.M(); } + void M() where T6 : I3 {} + + void Test(C6 x) + { + x.M(); + } +} + +class C7 where T7 : I1 +{ + void Test(C7 y) + { + } +} + +class C8 +{ + void M() where T8 : I1 {} + + void Test(C8 x) + { + x.M(); + } } "; var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, @@ -6474,14 +7002,64 @@ class C6 : C5 targetFramework: _supportingFramework, references: new[] { compilation1.ToMetadataReference() }); - compilation2.VerifyEmitDiagnostics(); + var expected = new[] { + // (21,32): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C3 x, C3 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I3", "I1.M01()").WithLocation(21, 32), + // (33,11): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I3", "I1.M01()").WithLocation(33, 11), + // (39,22): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // void Test(C5 y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I3", "I1.M01()").WithLocation(39, 22), + // (50,11): error CS8920: The interface 'I3' cannot be used as type argument. Static member 'I1.M01()' does not have a most specific implementation in the interface. + // x.M(); + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "M").WithArguments("I3", "I1.M01()").WithLocation(50, 11) + }; + + compilation2.VerifyDiagnostics(expected); compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll, parseOptions: TestOptions.RegularPreview, targetFramework: _supportingFramework, references: new[] { compilation1.EmitToImageReference() }); - compilation2.VerifyEmitDiagnostics(); + compilation2.VerifyDiagnostics(expected); + } + + [Fact] + public void ConstraintChecks_07() + { + var source1 = +@" +abstract class C +{ + public abstract void M() where U : T; + public void M0() { M(); } +} +interface I +{ + static abstract string P { get; } +} +class D : C +{ + public override void M() => System.Console.WriteLine(U.P); + + static void Main() + { + new D().M0(); + } +} +"; + var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework); + + compilation1.VerifyDiagnostics( + // (11,7): error CS8920: The interface 'I' cannot be used as type argument. Static member 'I.P' does not have a most specific implementation in the interface. + // class D : C + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "D").WithArguments("I", "I.P").WithLocation(11, 7) + ); } [Theory] @@ -8793,20 +9371,49 @@ class C parseOptions: TestOptions.RegularPreview, targetFramework: _supportingFramework); - compilation1.VerifyDiagnostics( - // (9,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. - // _ = x == x; - Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "x " + op + " x").WithLocation(9, 13), - // (14,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. - // _ = y == y; - Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "y " + op + " y").WithLocation(14, 13), - // (22,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. - // _ = a == a; - Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "a " + op + " a").WithLocation(22, 13), - // (27,98): error CS8382: An expression tree may not contain a tuple == or != operator - // _ = (System.Linq.Expressions.Expression)>>)(((int, C) b) => (b == b).ToString()); - Diagnostic(ErrorCode.ERR_ExpressionTreeContainsTupleBinOp, "b " + op + " b").WithLocation(27, 98) - ); + if (isVirtual) + { + compilation1.VerifyDiagnostics( + // (9,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. + // _ = x == x; + Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "x " + op + " x").WithLocation(9, 13), + // (14,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. + // _ = y == y; + Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "y " + op + " y").WithLocation(14, 13), + // (22,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. + // _ = a == a; + Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "a " + op + " a").WithLocation(22, 13), + // (27,98): error CS8382: An expression tree may not contain a tuple == or != operator + // _ = (System.Linq.Expressions.Expression)>>)(((int, C) b) => (b == b).ToString()); + Diagnostic(ErrorCode.ERR_ExpressionTreeContainsTupleBinOp, "b " + op + " b").WithLocation(27, 98) + ); + } + else + { + compilation1.VerifyDiagnostics( + // (7,34): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator true(I1)' does not have a most specific implementation in the interface. + // static void M02((int, C) x) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("I1", "I1.operator true(I1)").WithLocation(7, 34), + // (12,27): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator true(I1)' does not have a most specific implementation in the interface. + // void M03((int, C) y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I1", "I1.operator true(I1)").WithLocation(12, 27), + // (20,34): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator true(I1)' does not have a most specific implementation in the interface. + // static void MT1((int, C) a) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "a").WithArguments("I1", "I1.operator true(I1)").WithLocation(20, 34), + // (9,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. + // _ = x == x; + Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "x " + op + " x").WithLocation(9, 13), + // (14,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. + // _ = y == y; + Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "y " + op + " y").WithLocation(14, 13), + // (22,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. + // _ = a == a; + Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "a " + op + " a").WithLocation(22, 13), + // (27,98): error CS8382: An expression tree may not contain a tuple == or != operator + // _ = (System.Linq.Expressions.Expression)>>)(((int, C) b) => (b == b).ToString()); + Diagnostic(ErrorCode.ERR_ExpressionTreeContainsTupleBinOp, "b " + op + " b").WithLocation(27, 98) + ); + } } [Theory] @@ -9655,17 +10262,44 @@ static void MT2() where T : I1 targetFramework: _supportingFramework); compilation1.VerifyDiagnostics( + // (10,34): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator ==(T, T)' does not have a most specific implementation in the interface. + // static void M02((int, I1) x) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("I1", "I1.operator ==(T, T)").WithLocation(10, 34), // (12,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. - // _ = x == x; + // _ = x != x; Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "x " + op + " x").WithLocation(12, 13), + // (12,13): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator ==(T, T)' does not have a most specific implementation in the interface. + // _ = x != x; + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("I1", "I1.operator ==(T, T)").WithLocation(12, 13), + // (12,18): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator ==(T, T)' does not have a most specific implementation in the interface. + // _ = x != x; + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("I1", "I1.operator ==(T, T)").WithLocation(12, 18), + // (15,27): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator ==(T, T)' does not have a most specific implementation in the interface. + // void M03((int, I1) y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I1", "I1.operator ==(T, T)").WithLocation(15, 27), // (17,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. - // _ = y == y; + // _ = y != y; Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "y " + op + " y").WithLocation(17, 13), + // (17,13): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator ==(T, T)' does not have a most specific implementation in the interface. + // _ = y != y; + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I1", "I1.operator ==(T, T)").WithLocation(17, 13), + // (17,18): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator ==(T, T)' does not have a most specific implementation in the interface. + // _ = y != y; + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I1", "I1.operator ==(T, T)").WithLocation(17, 18), + // (23,37): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator ==(T, T)' does not have a most specific implementation in the interface. + // static void MT1((int, I1) a) where T : I1 + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "a").WithArguments("I1", "I1.operator ==(T, T)").WithLocation(23, 37), // (25,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. - // _ = a == a; + // _ = a != a; Diagnostic(ErrorCode.ERR_BadAbstractStaticMemberAccess, "a " + op + " a").WithLocation(25, 13), + // (25,13): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator ==(T, T)' does not have a most specific implementation in the interface. + // _ = a != a; + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "a").WithArguments("I1", "I1.operator ==(T, T)").WithLocation(25, 13), + // (25,18): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.operator ==(T, T)' does not have a most specific implementation in the interface. + // _ = a != a; + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "a").WithArguments("I1", "I1.operator ==(T, T)").WithLocation(25, 18), // (30,92): error CS8382: An expression tree may not contain a tuple == or != operator - // _ = (System.Linq.Expressions.Expression>)(((int, T) b) => (b == b).ToString()); + // _ = (System.Linq.Expressions.Expression>)(((int, T) b) => (b != b).ToString()); Diagnostic(ErrorCode.ERR_ExpressionTreeContainsTupleBinOp, "b " + op + " b").WithLocation(30, 92) ); } @@ -14137,7 +14771,7 @@ private static bool Execute(bool isVirtual) } #endif - return true; + return ExecutionConditionUtil.IsMonoOrCoreClr; } [ConditionalTheory(typeof(CoreClrOnly))] @@ -22717,7 +23351,16 @@ public class C1 : I1 parseOptions: TestOptions.RegularPreview, targetFramework: _supportingFramework); - CompileAndVerify(compilation3, sourceSymbolValidator: validate3, symbolValidator: validate3, verify: Verification.Skipped).VerifyDiagnostics(); + compilation3.VerifyDiagnostics( + // (4,28): error CS9044: 'C1' does not implement interface member 'I1.M01.get'. 'C1.M01.get' cannot implicitly implement an inaccessible member. + // public static int M01 { get; set; } + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("C1", "I1.M01.get", "C1.M01.get").WithLocation(4, 28), + // (4,33): error CS9044: 'C1' does not implement interface member 'I1.M01.set'. 'C1.M01.set' cannot implicitly implement an inaccessible member. + // public static int M01 { get; set; } + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("C1", "I1.M01.set", "C1.M01.set").WithLocation(4, 33) + ); + + validate3(compilation3.SourceModule); void validate3(ModuleSymbol module) { @@ -22860,7 +23503,13 @@ public class C1 : I1 parseOptions: TestOptions.RegularPreview, targetFramework: _supportingFramework); - CompileAndVerify(compilation3, sourceSymbolValidator: validate3, symbolValidator: validate3, verify: Verification.Skipped).VerifyDiagnostics(); + compilation3.VerifyDiagnostics( + // (4,33): error CS9044: 'C1' does not implement interface member 'I1.M01.set'. 'C1.M01.set' cannot implicitly implement an inaccessible member. + // public static int M01 { get; set; } + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("C1", "I1.M01.set", "C1.M01.set").WithLocation(4, 33) + ); + + validate3(compilation3.SourceModule); void validate3(ModuleSymbol module) { @@ -23027,7 +23676,10 @@ public static int M01 { set{} } compilation6.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.get' // public class C1 : I1 - Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("C1", "I1.M01.get").WithLocation(2, 19) + Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("C1", "I1.M01.get").WithLocation(2, 19), + // (4,28): error CS9044: 'C1' does not implement interface member 'I1.M01.set'. 'C1.M01.set' cannot implicitly implement an inaccessible member. + // public static int M01 { set{} } + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "set").WithArguments("C1", "I1.M01.set", "C1.M01.set").WithLocation(4, 28) ); c1 = compilation6.GlobalNamespace.GetTypeMember("C1"); @@ -23203,7 +23855,13 @@ public class C1 : I1 parseOptions: TestOptions.RegularPreview, targetFramework: _supportingFramework); - CompileAndVerify(compilation3, sourceSymbolValidator: validate3, symbolValidator: validate3, verify: Verification.Skipped).VerifyDiagnostics(); + compilation3.VerifyDiagnostics( + // (4,28): error CS9044: 'C1' does not implement interface member 'I1.M01.get'. 'C1.M01.get' cannot implicitly implement an inaccessible member. + // public static int M01 { get; set; } + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("C1", "I1.M01.get", "C1.M01.get").WithLocation(4, 28) + ); + + validate3(compilation3.SourceModule); void validate3(ModuleSymbol module) { @@ -23370,7 +24028,10 @@ public class C1 : I1 compilation6.VerifyDiagnostics( // (2,19): error CS0535: 'C1' does not implement interface member 'I1.M01.set' // public class C1 : I1 - Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("C1", "I1.M01.set").WithLocation(2, 19) + Diagnostic(ErrorCode.ERR_UnimplementedInterfaceMember, "I1").WithArguments("C1", "I1.M01.set").WithLocation(2, 19), + // (4,28): error CS9044: 'C1' does not implement interface member 'I1.M01.get'. 'C1.M01.get' cannot implicitly implement an inaccessible member. + // public static int M01 { get; } + Diagnostic(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, "get").WithArguments("C1", "I1.M01.get", "C1.M01.get").WithLocation(4, 28) ); c1 = compilation6.GlobalNamespace.GetTypeMember("C1"); @@ -28914,12 +29575,21 @@ class C // (4,39): error CS0552: 'I1.implicit operator bool(I1)': user-defined conversions to or from an interface are not allowed // abstract static implicit operator bool(I1 x); Diagnostic(ErrorCode.ERR_ConversionWithInterface, "bool").WithArguments("I1.implicit operator bool(I1)").WithLocation(4, 39), + // (7,34): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.implicit operator bool(I1)' does not have a most specific implementation in the interface. + // static void M02((int, C) x) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "x").WithArguments("I1", "I1.implicit operator bool(I1)").WithLocation(7, 34), // (9,13): error CS0029: Cannot implicitly convert type 'I1' to 'bool' // _ = x == x; Diagnostic(ErrorCode.ERR_NoImplicitConv, "x " + op + " x").WithArguments("I1", "bool").WithLocation(9, 13), + // (12,27): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.implicit operator bool(I1)' does not have a most specific implementation in the interface. + // void M03((int, C) y) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "y").WithArguments("I1", "I1.implicit operator bool(I1)").WithLocation(12, 27), // (14,13): error CS0029: Cannot implicitly convert type 'I1' to 'bool' // _ = y == y; Diagnostic(ErrorCode.ERR_NoImplicitConv, "y " + op + " y").WithArguments("I1", "bool").WithLocation(14, 13), + // (20,34): error CS8920: The interface 'I1' cannot be used as type argument. Static member 'I1.implicit operator bool(I1)' does not have a most specific implementation in the interface. + // static void MT1((int, C) a) + Diagnostic(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, "a").WithArguments("I1", "I1.implicit operator bool(I1)").WithLocation(20, 34), // (22,13): error CS0029: Cannot implicitly convert type 'I1' to 'bool' // _ = a == a; Diagnostic(ErrorCode.ERR_NoImplicitConv, "a " + op + " a").WithArguments("I1", "bool").WithLocation(22, 13), @@ -29905,7 +30575,7 @@ static C1 M03(int y) where T : I1> [CombinatorialData] public void ConsumeAbstractConversionOperator_10([CombinatorialValues("implicit", "explicit")] string op) { - // Look in derived interfaces + // Look in base interfaces for source string metadataName = ConversionOperatorName(op); bool needCast = op == "explicit"; @@ -29953,13 +30623,16 @@ .locals init (int V_0) } [Theory] - [CombinatorialData] - public void ConsumeAbstractConversionOperator_11([CombinatorialValues("implicit", "explicit")] string op) + [InlineData("implicit", false)] + [InlineData("implicit", true)] + [InlineData("explicit", false)] + [InlineData("explicit", true)] + public void ConsumeAbstractConversionOperator_11(string op, bool useCast) { // Same as ConsumeAbstractConversionOperator_10 only direction of conversion is flipped + // Look in base interfaces for destination for explicit cast in code string metadataName = ConversionOperatorName(op); - bool needCast = op == "explicit"; var source1 = @" @@ -29975,7 +30648,7 @@ class Test { static T M02(int x) where T : U where U : I2 { - return " + (needCast ? "(T)" : "") + @"x; + return " + (useCast ? "(T)" : "") + @"x; } } "; @@ -29983,10 +30656,12 @@ static T M02(int x) where T : U where U : I2 parseOptions: TestOptions.RegularPreview, targetFramework: _supportingFramework); - var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); + if (useCast) + { + var verifier = CompileAndVerify(compilation1, verify: Verification.Skipped).VerifyDiagnostics(); - verifier.VerifyIL("Test.M02(int)", -@" + verifier.VerifyIL("Test.M02(int)", + @" { // Code size 18 (0x12) .maxstack 1 @@ -30001,6 +30676,15 @@ .locals init (T V_0) IL_0011: ret } "); + } + else + { + compilation1.VerifyDiagnostics( + // (14,16): error CS0266: Cannot implicitly convert type 'int' to 'T'. An explicit conversion exists (are you missing a cast?) + // return x; + Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "x").WithArguments("int", "T").WithLocation(14, 16) + ); + } } [Theory] @@ -30146,7 +30830,7 @@ .locals init (T V_0) [CombinatorialData] public void ConsumeAbstractConversionOperator_15([CombinatorialValues("implicit", "explicit")] string op) { - // If there is a non-trivial class constraint, interfaces are not looked at. + // If there is an applicable candidate in effective base class, interfaces are not looked at. string metadataName = ConversionOperatorName(op); bool needCast = op == "explicit"; @@ -30248,7 +30932,7 @@ .locals init (T V_0) [CombinatorialData] public void ConsumeAbstractConversionOperator_17([CombinatorialValues("implicit", "explicit")] string op) { - // If there is a non-trivial class constraint, interfaces are not looked at. + // If there is no applicable candidate in effective base class, look in interfaces. bool needCast = op == "explicit"; @@ -30274,16 +30958,32 @@ static int M03(T y) where T : U where U : I1 { return " + (needCast ? "(int)" : "") + @"y; } + + static void Main() + { + var c2 = new C2(); + M02(c2); + M03(c2); + } +} + +public class C2 : C1, I1 +{ + public static " + op + @" operator int(C2 x) + { + System.Console.WriteLine(""C2 conversion""); + return default; + } } "; - var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, + var compilation1 = CreateCompilation(source1, options: TestOptions.DebugExe, parseOptions: TestOptions.RegularPreview, targetFramework: _supportingFramework); - compilation1.VerifyDiagnostics( - // (15,16): error CS0030: Cannot convert type 'T' to 'int' - // return (int)x; - Diagnostic((op == "explicit" ? ErrorCode.ERR_NoExplicitConv : ErrorCode.ERR_NoImplicitConv), (needCast ? "(int)" : "") + "x").WithArguments("T", "int").WithLocation(15, 16) - ); + + CompileAndVerify(compilation1, verify: Verification.Skipped, expectedOutput: !Execute(isVirtual: false) ? null : @" +C2 conversion +C2 conversion +").VerifyDiagnostics(); } [Theory] @@ -30316,16 +31016,84 @@ static T M03(int y) where T : U where U : I1 { return " + (needCast ? "(T)" : "") + @"y; } + + static void Main() + { + M02(0); + M03(1); + } +} + +public class C2 : C1, I1 +{ + public static " + op + @" operator C2(int x) + { + System.Console.WriteLine(""C2 conversion""); + return default; + } } "; - var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, + var compilation1 = CreateCompilation(source1, options: TestOptions.DebugExe, parseOptions: TestOptions.RegularPreview, targetFramework: _supportingFramework); - compilation1.VerifyDiagnostics( - // (15,16): error CS0030: Cannot convert type 'int' to 'T' - // return (T)x; - Diagnostic((op == "explicit" ? ErrorCode.ERR_NoExplicitConv : ErrorCode.ERR_NoImplicitConv), (needCast ? "(T)" : "") + "x").WithArguments("int", "T").WithLocation(15, 16) - ); + + CompileAndVerify(compilation1, verify: Verification.Skipped, expectedOutput: !Execute(isVirtual: false) ? null : @" +C2 conversion +C2 conversion +").VerifyDiagnostics(); + } + + [Fact] + [WorkItem(56753, "https://github.com/dotnet/roslyn/issues/56753")] + public void ConsumeAbstractConversionOperator_19() + { + var source1 = +@" +interface I1 { } + +abstract class Base : I1 {} + +interface I2 where T : class, I2 +{ + public static abstract implicit operator T(string value); +} + +class Derived : Base, I2 +{ + public static implicit operator Derived(string value) + { + System.Console.WriteLine(""Derived conversion""); + return default; + } +} + +static class Util +{ + static void Method1(string value) where T : Base, I2 + { + var newT = (T)value; + } + + static void Method2(string value) where T : class, I1, I2 + { + var newT = (T)value; + } + + static void Main() + { + Method1(""""); + Method2(""""); + } +} +"; + var compilation1 = CreateCompilation(source1, options: TestOptions.DebugExe, + parseOptions: TestOptions.RegularPreview, + targetFramework: _supportingFramework); + + CompileAndVerify(compilation1, verify: Verification.Skipped, expectedOutput: !Execute(isVirtual: false) ? null : @" +Derived conversion +Derived conversion +").VerifyDiagnostics(); } [Theory] diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/LineSpanDirectiveParsingTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/LineSpanDirectiveParsingTests.cs index c640a6dbd6a91..55f7c83168014 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/LineSpanDirectiveParsingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/LineSpanDirectiveParsingTests.cs @@ -5,6 +5,7 @@ using System.Linq; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; +using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; @@ -42,10 +43,7 @@ public void IsActive() UsingLineDirective(source, TestOptions.Regular9); verify(); - UsingLineDirective(source, TestOptions.Regular9.WithPreprocessorSymbols("IsActive"), - // (2,2): error CS8773: Feature 'line span directive' is not available in C# 9.0. Please use language version 10.0 or greater. - // #line (1, 2) - (3, 4) "file.cs" - Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "line").WithArguments("line span directive", "10.0").WithLocation(2, 2)); + UsingLineDirective(source, TestOptions.Regular9.WithPreprocessorSymbols("IsActive")); verify(); void verify() @@ -83,10 +81,7 @@ public void LineDirective_01() { string source = @"#line (1, 2) - (3, 4) ""file.cs"""; - UsingLineDirective(source, TestOptions.Regular9, - // (1,2): error CS8773: Feature 'line span directive' is not available in C# 9.0. Please use language version 10.0 or greater. - // #line (1, 2) - (3, 4) "file.cs" - Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "line").WithArguments("line span directive", "10.0").WithLocation(1, 2)); + UsingLineDirective(source, TestOptions.Regular9); verify(); UsingLineDirective(source, TestOptions.Regular10); @@ -127,10 +122,7 @@ public void LineDirective_02() { string source = @"#line (1, 2) - (3, 4) 5 ""file.cs"""; - UsingLineDirective(source, TestOptions.Regular9, - // (1,2): error CS8773: Feature 'line span directive' is not available in C# 9.0. Please use language version 10.0 or greater. - // #line (1, 2) - (3, 4) "file.cs" - Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "line").WithArguments("line span directive", "10.0").WithLocation(1, 2)); + UsingLineDirective(source, TestOptions.Regular9); verify(); UsingLineDirective(source, TestOptions.Regular10); @@ -241,7 +233,13 @@ public void LineDirective_05() { string source = @"#line(1,2)-(3,4)""file.cs"""; - UsingLineDirective(source, options: null); + UsingLineDirective(source, options: null, + // (1,6): error CS9028: The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + // #line(1,2)-(3,4)"file.cs" + Diagnostic(ErrorCode.ERR_LineSpanDirectiveRequiresSpace, "(1,2)").WithLocation(1, 6), + // (1,17): error CS9028: The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + // #line(1,2)-(3,4)"file.cs" + Diagnostic(ErrorCode.ERR_LineSpanDirectiveRequiresSpace, @"""file.cs""").WithLocation(1, 17)); N(SyntaxKind.LineSpanDirectiveTrivia); { @@ -271,10 +269,89 @@ public void LineDirective_05() } [Fact] + public void LineDirective_05_WithRequiredSpaces() + { + string source = @"#line (1,2)-(3,4) ""file.cs"""; + + UsingLineDirective(source, options: null); + + N(SyntaxKind.LineSpanDirectiveTrivia); + { + N(SyntaxKind.HashToken); + N(SyntaxKind.LineKeyword); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "1"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "2"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.MinusToken); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "3"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "4"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.StringLiteralToken, "\"file.cs\""); + N(SyntaxKind.EndOfDirectiveToken); + } + EOF(); + } + + [Fact, WorkItem(61663, "https://github.com/dotnet/roslyn/issues/61663")] public void LineDirective_06() { string source = @"#line(1,2)-(3,4)5""file.cs"""; + UsingLineDirective(source, options: null, + // (1,6): error CS9028: The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + // #line(1,2)-(3,4)5"file.cs" + Diagnostic(ErrorCode.ERR_LineSpanDirectiveRequiresSpace, "(1,2)").WithLocation(1, 6), + // (1,17): error CS9028: The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + // #line(1,2)-(3,4)5"file.cs" + Diagnostic(ErrorCode.ERR_LineSpanDirectiveRequiresSpace, "5").WithLocation(1, 17), + // (1,18): error CS9028: The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + // #line(1,2)-(3,4)5"file.cs" + Diagnostic(ErrorCode.ERR_LineSpanDirectiveRequiresSpace, @"""file.cs""").WithLocation(1, 18) + ); + + N(SyntaxKind.LineSpanDirectiveTrivia); + { + N(SyntaxKind.HashToken); + N(SyntaxKind.LineKeyword); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "1"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "2"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.MinusToken); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "3"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "4"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.NumericLiteralToken, "5"); + N(SyntaxKind.StringLiteralToken, "\"file.cs\""); + N(SyntaxKind.EndOfDirectiveToken); + } + EOF(); + } + + [Fact] + public void LineDirective_06_WithRequiredSpaces() + { + string source = @"#line (1,2)-(3,4) 5 ""file.cs"""; + UsingLineDirective(source, options: null); N(SyntaxKind.LineSpanDirectiveTrivia); @@ -675,7 +752,7 @@ public void Incomplete_10() EOF(); } - [Fact] + [Fact, WorkItem(61663, "https://github.com/dotnet/roslyn/issues/61663")] public void Incomplete_11() { string source = @"#line (1, 2) - (3, 4)"; @@ -712,7 +789,7 @@ public void Incomplete_11() EOF(); } - [Fact] + [Fact, WorkItem(61663, "https://github.com/dotnet/roslyn/issues/61663")] public void Incomplete_12() { string source = @"#line (1, 2) - (3, 4) 5"; @@ -2266,5 +2343,159 @@ public void NotUTF8StringLiteral_16() } EOF(); } + + [Fact, WorkItem(61663, "https://github.com/dotnet/roslyn/issues/61663")] + public void RequireSpace_BeforeFirstParen() + { + string source = @"#line(1, 2) - (3, 4) ""file.cs"""; + + UsingLineDirective(source, TestOptions.Regular10, + // (1,6): error CS9028: The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + // #line(1, 2) - (3, 4) "file.cs" + Diagnostic(ErrorCode.ERR_LineSpanDirectiveRequiresSpace, "(1, 2)").WithLocation(1, 6) + ); + + N(SyntaxKind.LineSpanDirectiveTrivia); + { + N(SyntaxKind.HashToken); + N(SyntaxKind.LineKeyword); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "1"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "2"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.MinusToken); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "3"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "4"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.StringLiteralToken, "\"file.cs\""); + N(SyntaxKind.EndOfDirectiveToken); + } + EOF(); + } + + [Fact, WorkItem(61663, "https://github.com/dotnet/roslyn/issues/61663")] + public void RequireSpace_BeforeCharacterOffset() + { + string source = @"#line (1, 2) - (3, 4)5 ""file.cs"""; + + UsingLineDirective(source, TestOptions.Regular10, + // (1,22): error CS9028: The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + // #line (1, 2) - (3, 4)5 "file.cs" + Diagnostic(ErrorCode.ERR_LineSpanDirectiveRequiresSpace, "5").WithLocation(1, 22) + ); + + N(SyntaxKind.LineSpanDirectiveTrivia); + { + N(SyntaxKind.HashToken); + N(SyntaxKind.LineKeyword); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "1"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "2"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.MinusToken); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "3"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "4"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.NumericLiteralToken, "5"); + N(SyntaxKind.StringLiteralToken, "\"file.cs\""); + N(SyntaxKind.EndOfDirectiveToken); + } + EOF(); + } + + [Fact, WorkItem(61663, "https://github.com/dotnet/roslyn/issues/61663")] + public void RequireSpace_BeforeFilename() + { + string source = @"#line (1, 2) - (3, 4) 5""file.cs"""; + + UsingLineDirective(source, TestOptions.Regular10, + // (1,24): error CS9028: The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + // #line (1, 2) - (3, 4) 5"file.cs" + Diagnostic(ErrorCode.ERR_LineSpanDirectiveRequiresSpace, @"""file.cs""").WithLocation(1, 24) + ); + + N(SyntaxKind.LineSpanDirectiveTrivia); + { + N(SyntaxKind.HashToken); + N(SyntaxKind.LineKeyword); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "1"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "2"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.MinusToken); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "3"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "4"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.NumericLiteralToken, "5"); + N(SyntaxKind.StringLiteralToken, "\"file.cs\""); + N(SyntaxKind.EndOfDirectiveToken); + } + EOF(); + } + + [Fact, WorkItem(61663, "https://github.com/dotnet/roslyn/issues/61663")] + public void RequireSpace_BeforeFilename_WithoutCharacterOffset() + { + string source = @"#line (1, 2) - (3, 4)""file.cs"""; + + UsingLineDirective(source, TestOptions.Regular10, + // (1,22): error CS9028: The #line span directive requires space before the first parenthesis, before the character offset, and before the file name + // #line (1, 2) - (3, 4)"file.cs" + Diagnostic(ErrorCode.ERR_LineSpanDirectiveRequiresSpace, @"""file.cs""").WithLocation(1, 22) + ); + + N(SyntaxKind.LineSpanDirectiveTrivia); + { + N(SyntaxKind.HashToken); + N(SyntaxKind.LineKeyword); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "1"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "2"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.MinusToken); + N(SyntaxKind.LineDirectivePosition); + { + N(SyntaxKind.OpenParenToken); + N(SyntaxKind.NumericLiteralToken, "3"); + N(SyntaxKind.CommaToken); + N(SyntaxKind.NumericLiteralToken, "4"); + N(SyntaxKind.CloseParenToken); + } + N(SyntaxKind.StringLiteralToken, "\"file.cs\""); + N(SyntaxKind.EndOfDirectiveToken); + } + EOF(); + } } } diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Attributes/AttributeData.vb b/src/Compilers/VisualBasic/Portable/Symbols/Attributes/AttributeData.vb index 263ba82b4fdb5..f1547defa222a 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Attributes/AttributeData.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Attributes/AttributeData.vb @@ -243,9 +243,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols diagnostics.Add(If(nodeOpt IsNot Nothing, nodeOpt.Name.GetLocation, NoLocation.Singleton), useSiteInfo) End If - ' BC31205: First argument to a security attribute must be a valid SecurityAction - diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_SecurityAttributeMissingAction, - Me.AttributeClass), + ' BC31211: First argument to a security attribute must be a valid SecurityAction + diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_SecurityAttributeMissingAction), If(nodeOpt IsNot Nothing, nodeOpt.Name.GetLocation, NoLocation.Singleton)) hasErrors = True @@ -253,6 +252,31 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Return Nothing End Function + Friend Shared Function GetArgumentLocation(nodeOpt As AttributeSyntax, argumentIndex As Integer) As Location + Return GetArgumentDisplayAndLocation(nodeOpt, 0, argumentIndex).Location + End Function + + Private Shared Function GetArgumentDisplayAndLocation(nodeOpt As AttributeSyntax, value As Integer, argumentIndex As Integer) As (ArgumentDisplay As String, Location As Location) + If nodeOpt IsNot Nothing Then + If nodeOpt.ArgumentList IsNot Nothing AndAlso nodeOpt.ArgumentList.Arguments.Count > argumentIndex Then + Dim arg As ArgumentSyntax = nodeOpt.ArgumentList.Arguments(argumentIndex) + Return (arg.ToString(), arg.GetLocation()) + Else + Return (value.ToString(), nodeOpt.GetLocation()) + End If + Else + Return ("", NoLocation.Singleton) + End If + End Function + + Friend Shared Function GetFirstArgumentLocation(nodeOpt As AttributeSyntax) As Location + Return GetArgumentLocation(nodeOpt, argumentIndex:=0) + End Function + + Private Shared Function GetFirstArgumentDisplayAndLocation(nodeOpt As AttributeSyntax, value As Integer) As (ArgumentDisplay As String, Location As Location) + Return GetArgumentDisplayAndLocation(nodeOpt, value, argumentIndex:=0) + End Function + Private Function ValidateSecurityAction( typedValue As TypedConstant, targetSymbol As Symbol, @@ -271,10 +295,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols DeclarativeSecurityAction.LinkDemand If Me.IsTargetAttribute(targetSymbol, AttributeDescription.PrincipalPermissionAttribute) Then - ' BC31209: SecurityAction value '{0}' is invalid for PrincipalPermission attribute - diagnostics.Add(ERRID.ERR_PrincipalPermissionInvalidAction, - If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation(), NoLocation.Singleton), - If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).ToString(), "")) + ' BC31215: SecurityAction value '{0}' is invalid for PrincipalPermission attribute + Dim displayAndLocation As (ArgumentDisplay As String, Location As Location) = GetFirstArgumentDisplayAndLocation(nodeOpt, securityAction) + diagnostics.Add(ERRID.ERR_PrincipalPermissionInvalidAction, displayAndLocation.Location, displayAndLocation.ArgumentDisplay) hasErrors = True Return DeclarativeSecurityAction.None @@ -301,11 +324,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols isPermissionRequestAction = True Case Else - ' BC31206: Security attribute '{0}' has an invalid SecurityAction value '{1}' - diagnostics.Add(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, - If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation(), NoLocation.Singleton), - If(nodeOpt IsNot Nothing, nodeOpt.Name.ToString, ""), - If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).ToString(), "")) + ' BC31214: SecurityAction value '{0}' is invalid for security attributes applied to a type or a method. + Dim displayAndLocation As (ArgumentDisplay As String, Location As Location) = GetFirstArgumentDisplayAndLocation(nodeOpt, securityAction) + diagnostics.Add(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, displayAndLocation.Location, displayAndLocation.ArgumentDisplay) hasErrors = True Return DeclarativeSecurityAction.None @@ -315,10 +336,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols If targetSymbol.Kind = SymbolKind.NamedType OrElse targetSymbol.Kind = SymbolKind.Method Then ' Types and methods cannot take permission requests. - ' BC31208: SecurityAction value '{0}' is invalid for security attributes applied to a type or a method - diagnostics.Add(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, - If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation, NoLocation.Singleton), - If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).ToString(), "")) + ' BC31214: SecurityAction value '{0}' is invalid for security attributes applied to a type or a method. + Dim displayAndLocation As (ArgumentDisplay As String, Location As Location) = GetFirstArgumentDisplayAndLocation(nodeOpt, securityAction) + diagnostics.Add(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, displayAndLocation.Location, displayAndLocation.ArgumentDisplay) hasErrors = True Return DeclarativeSecurityAction.None @@ -327,10 +347,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ElseIf targetSymbol.Kind = SymbolKind.Assembly Then ' Assemblies cannot take declarative security. - ' BC31207: SecurityAction value '{0}' is invalid for security attributes applied to an assembly - diagnostics.Add(ERRID.ERR_SecurityAttributeInvalidActionAssembly, - If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation, NoLocation.Singleton), - If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).ToString(), "")) + ' BC31213: SecurityAction value '{0}' is invalid for security attributes applied to an assembly. + Dim displayAndLocation As (ArgumentDisplay As String, Location As Location) = GetFirstArgumentDisplayAndLocation(nodeOpt, securityAction) + diagnostics.Add(ERRID.ERR_SecurityAttributeInvalidActionAssembly, displayAndLocation.Location, displayAndLocation.ArgumentDisplay) hasErrors = True Return DeclarativeSecurityAction.None @@ -376,7 +395,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols If resolvedFilePath Is Nothing Then - ' BC31210: Unable to resolve file path '{0}' specified for the named argument '{1}' for PermissionSet attribute + ' BC31216: Unable to resolve file path '{0}' specified for the named argument '{1}' for PermissionSet attribute. Dim argSyntaxLocation As Location = If(arguments.AttributeSyntaxOpt IsNot Nothing, arguments.AttributeSyntaxOpt.ArgumentList.Arguments(1).GetLocation(), NoLocation.Singleton) @@ -429,14 +448,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Case ClassInterfaceType.None, Cci.Constants.ClassInterfaceType_AutoDispatch, Cci.Constants.ClassInterfaceType_AutoDual Exit Select Case Else - diagnostics.Add(ERRID.ERR_BadAttribute1, If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation(), NoLocation.Singleton), Me.AttributeClass) + Dim location As Location = GetFirstArgumentLocation(nodeOpt) + diagnostics.Add(ERRID.ERR_BadAttribute1, location, Me.AttributeClass) End Select End Sub Friend Sub DecodeInterfaceTypeAttribute(node As AttributeSyntax, diagnostics As BindingDiagnosticBag) Dim discarded As ComInterfaceType = Nothing If Not DecodeInterfaceTypeAttribute(discarded) Then - diagnostics.Add(ERRID.ERR_BadAttribute1, node.ArgumentList.Arguments(0).GetLocation(), Me.AttributeClass) + Dim location As Location = GetFirstArgumentLocation(node) + diagnostics.Add(ERRID.ERR_BadAttribute1, location, Me.AttributeClass) End If End Sub @@ -477,9 +498,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ' Native compiler allows only a specific GUID format: "D" format (32 digits separated by hyphens) Dim guidVal As Guid If Not Guid.TryParseExact(guidString, "D", guidVal) Then - diagnostics.Add(ERRID.ERR_BadAttributeUuid2, - If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation(), NoLocation.Singleton), - Me.AttributeClass, If(guidString, ObjectDisplay.NullLiteral)) + Dim location As Location = GetFirstArgumentLocation(nodeOpt) + diagnostics.Add(ERRID.ERR_BadAttributeUuid2, location, Me.AttributeClass, If(guidString, ObjectDisplay.NullLiteral)) End If End Sub diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb index a17ea95d20bda..13733e7c3a794 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb @@ -1133,7 +1133,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols For i = 0 To argCount - 1 Dim arg As Integer = attrData.GetConstructorArgument(Of Integer)(i, SpecialType.System_Int32) If arg < 0 Then - diagnostics.Add(ERRID.ERR_BadAttribute1, If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(i).GetLocation(), NoLocation.Singleton), attrData.AttributeClass) + diagnostics.Add(ERRID.ERR_BadAttribute1, VisualBasicAttributeData.GetArgumentLocation(nodeOpt, i), attrData.AttributeClass) End If Next End Sub diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceFieldSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceFieldSymbol.vb index 0d182e60056ce..e6827cfdcef82 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceFieldSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceFieldSymbol.vb @@ -730,7 +730,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ElseIf attrData.IsTargetAttribute(Me, AttributeDescription.FieldOffsetAttribute) Then Dim offset = attrData.CommonConstructorArguments(0).DecodeValue(Of Integer)(SpecialType.System_Int32) If offset < 0 Then - diagnostics.Add(ERRID.ERR_BadAttribute1, arguments.AttributeSyntaxOpt.ArgumentList.Arguments(0).GetLocation(), attrData.AttributeClass) + diagnostics.Add(ERRID.ERR_BadAttribute1, VisualBasicAttributeData.GetFirstArgumentLocation(arguments.AttributeSyntaxOpt), attrData.AttributeClass) offset = 0 End If diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMethodSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMethodSymbol.vb index fb05b9650cd15..63f4f03001473 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMethodSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMethodSymbol.vb @@ -1651,7 +1651,7 @@ lReportErrorOnTwoTokens: Dim moduleName As String = TryCast(attrData.CommonConstructorArguments(0).ValueInternal, String) If Not MetadataHelpers.IsValidMetadataIdentifier(moduleName) Then - diagnostics.Add(ERRID.ERR_BadAttribute1, arguments.AttributeSyntaxOpt.ArgumentList.Arguments(0).GetLocation(), attrData.AttributeClass) + diagnostics.Add(ERRID.ERR_BadAttribute1, VisualBasicAttributeData.GetFirstArgumentLocation(arguments.AttributeSyntaxOpt), attrData.AttributeClass) End If ' Default value of charset is inherited from the module (only if specified). diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceModuleSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceModuleSymbol.vb index 7d175e19ed26b..adc6afbada207 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceModuleSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceModuleSymbol.vb @@ -1096,7 +1096,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols If attrData.IsTargetAttribute(Me, AttributeDescription.DefaultCharSetAttribute) Then Dim charSet As CharSet = attrData.GetConstructorArgument(Of CharSet)(0, SpecialType.System_Enum) If Not CommonModuleWellKnownAttributeData.IsValidCharSet(charSet) Then - DirectCast(arguments.Diagnostics, BindingDiagnosticBag).Add(ERRID.ERR_BadAttribute1, arguments.AttributeSyntaxOpt.ArgumentList.Arguments(0).GetLocation(), attrData.AttributeClass) + DirectCast(arguments.Diagnostics, BindingDiagnosticBag).Add(ERRID.ERR_BadAttribute1, VisualBasicAttributeData.GetFirstArgumentLocation(arguments.AttributeSyntaxOpt), attrData.AttributeClass) Else arguments.GetOrCreateData(Of CommonModuleWellKnownAttributeData)().DefaultCharacterSet = charSet End If diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_StructLayout.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_StructLayout.vb index 01d8b03f30952..9ea8a80736567 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_StructLayout.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_StructLayout.vb @@ -691,6 +691,37 @@ BC30127: Attribute 'FieldOffsetAttribute' is not valid: Incorrect argument value ]]>) End Sub + + Public Sub ExplicitFieldLayout_Errors2() + Dim source = + + + Dim b As Integer +End Class +]]> + + + + CreateCompilationWithMscorlib40(source).AssertTheseDiagnostics( + ~~~~~~~~~~~ +]]>) + End Sub + Public Sub ReadingFromMetadata() Using [module] = ModuleMetadata.CreateFromImage(TestResources.MetadataTests.Invalid.ClassLayout) diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.vb index b69e66042eb0b..0c138059aa558 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.vb @@ -1092,6 +1092,37 @@ End Class Diagnostic(ERRID.ERR_BadAttribute1, "EntryPoint:=ChrW(&HDC00) & ChrW(&HD800)").WithArguments("System.Runtime.InteropServices.DllImportAttribute")) End Sub + + Public Sub DllImport_InvalidArgs2() + Dim source = + + + Public Shared Sub F1() + End Sub +End Class +]]> + + + CreateCompilationWithMscorlib40AndVBRuntime(source).AssertTheseDiagnostics( + ~~~~~~~~~ +]]>) + End Sub + Public Sub DllImport_SpecialCharactersInName() Dim source = @@ -2275,7 +2306,6 @@ End Class End Sub) End Sub - Public Sub DllImport_DefaultCharSet_Errors() Dim source = @@ -2296,6 +2326,34 @@ BC30127: Attribute 'DefaultCharSetAttribute' is not valid: Incorrect argument va ]]>) End Sub + + Public Sub DllImport_DefaultCharSet_Errors2() + Dim source = + + + +Namespace System.Runtime.InteropServices + Public Class DefaultCharSetAttribute + Inherits Attribute + + Public Sub New(Optional charSet As CharSet = Integer.MaxValue) + End Sub + End Class +End Namespace +]]> + + + + CreateCompilationWithMscorlib40(source).AssertTheseDiagnostics( + ~~~~~~~~~~~~~~~~~~~~~ +]]>) + End Sub + Public Sub DefaultCharSet_Types() Dim source = @@ -3762,14 +3820,102 @@ end class Dim comp = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(source) - comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_OmittedArgument2, "FileIOPermission").WithArguments("action", "Public Overloads Sub New(action As System.Security.Permissions.SecurityAction)"), - Diagnostic(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, "DirectCast(0, SecurityAction)").WithArguments("MySecurityAttribute", "DirectCast(0, SecurityAction)"), - Diagnostic(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, "DirectCast(11, SecurityAction)").WithArguments("MySecurityAttribute", "DirectCast(11, SecurityAction)"), - Diagnostic(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, "DirectCast(-1, SecurityAction)").WithArguments("MySecurityAttribute", "DirectCast(-1, SecurityAction)"), - Diagnostic(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, "DirectCast(0, SecurityAction)").WithArguments("FileIOPermission", "DirectCast(0, SecurityAction)"), - Diagnostic(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, "DirectCast(11, SecurityAction)").WithArguments("FileIOPermission", "DirectCast(11, SecurityAction)"), - Diagnostic(ERRID.ERR_SecurityAttributeInvalidActionTypeOrMethod, "DirectCast(-1, SecurityAction)").WithArguments("FileIOPermission", "DirectCast(-1, SecurityAction)"), - Diagnostic(ERRID.ERR_InvalidAttributeUsage2, "FileIOPermission").WithArguments("FileIOPermissionAttribute", "Field")) + comp.AssertTheseDiagnostics( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BC31214: SecurityAction value 'DirectCast(11, SecurityAction)' is invalid for security attributes applied to a type or a method. + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BC31214: SecurityAction value 'DirectCast(-1, SecurityAction)' is invalid for security attributes applied to a type or a method. + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BC31214: SecurityAction value 'DirectCast(0, SecurityAction)' is invalid for security attributes applied to a type or a method. + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BC31214: SecurityAction value 'DirectCast(11, SecurityAction)' is invalid for security attributes applied to a type or a method. + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BC31214: SecurityAction value 'DirectCast(-1, SecurityAction)' is invalid for security attributes applied to a type or a method. + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BC30455: Argument not specified for parameter 'action' of 'Public Overloads Sub New(action As SecurityAction)'. + + ~~~~~~~~~~~~~~~~ +BC30662: Attribute 'FileIOPermissionAttribute' cannot be applied to 'Field' because the attribute is not valid on this declaration type. + + ~~~~~~~~~~~~~~~~ +]]>) + End Sub + + + Public Sub TestInvalidSecurityActionErrors_UserDefinedWithOptionalParameterInCtor_PermissionsRequestAction() + Dim source = + + +Class A +End Class +]]> + + + + Dim comp = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(source) + comp.AssertTheseDiagnostics( + ~~~~~~~~~~~~~~~~~~~ +]]>) + End Sub + + + Public Sub TestInvalidSecurityActionErrors_UserDefinedWithOptionalParameterInCtor() + Dim source = + + +Class A +End Class +]]> + + + + Dim comp = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(source) + comp.AssertTheseDiagnostics( + ~~~~~~~~~~~~~~~~~~~ +]]>) End Sub @@ -3811,14 +3957,26 @@ end class Dim comp = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(source) - comp.VerifyDiagnostics( - Diagnostic(ERRID.ERR_SecurityAttributeMissingAction, "MySecurityAttribute").WithArguments("MySecurityAttribute"), - Diagnostic(ERRID.ERR_SecurityAttributeMissingAction, "MySecurityAttribute").WithArguments("MySecurityAttribute"), - Diagnostic(ERRID.ERR_SecurityAttributeMissingAction, "MySecurityAttribute").WithArguments("MySecurityAttribute"), - Diagnostic(ERRID.ERR_SecurityAttributeMissingAction, "MySecurityAttribute").WithArguments("MySecurityAttribute"), - Diagnostic(ERRID.ERR_SecurityAttributeMissingAction, "MySecurityAttribute").WithArguments("MySecurityAttribute"), - Diagnostic(ERRID.ERR_SecurityAttributeMissingAction, "MySecurityAttribute").WithArguments("MySecurityAttribute") - ) + comp.AssertTheseDiagnostics( + ~~~~~~~~~~~~~~~~~~~ +BC31211: First argument to a security attribute must be a valid SecurityAction. + + ~~~~~~~~~~~~~~~~~~~ +BC31211: First argument to a security attribute must be a valid SecurityAction. + + ~~~~~~~~~~~~~~~~~~~ +BC31211: First argument to a security attribute must be a valid SecurityAction. + + ~~~~~~~~~~~~~~~~~~~ +BC31211: First argument to a security attribute must be a valid SecurityAction. + + ~~~~~~~~~~~~~~~~~~~ +BC31211: First argument to a security attribute must be a valid SecurityAction. + + ~~~~~~~~~~~~~~~~~~~ +]]>) End Sub @@ -3895,6 +4053,40 @@ end class Diagnostic(ERRID.ERR_SecurityAttributeInvalidActionAssembly, "SecurityAction.PermitOnly").WithArguments("SecurityAction.PermitOnly")) End Sub + + Public Sub TestInvalidSecurityActionsForAssemblyErrors_UserDefinedWithOptionalParameterInCtor() + Dim source = + + + +Class MySecurityAttribute + Inherits SecurityAttribute + + Public Sub New (Optional a As SecurityAction = 1) + MyBase.New(a) + End Sub + + Public Overrides Function CreatePermission() As IPermission + Return Nothing + End Function +End Class + +]]> + + + + Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime(source) + compilation.AssertTheseDiagnostics( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +]]>) + End Sub + Public Sub TestInvalidSecurityActionForTypeOrMethod() Dim source = @@ -4042,6 +4234,45 @@ End Class Diagnostic(ERRID.ERR_PrincipalPermissionInvalidAction, "SecurityAction.LinkDemand").WithArguments("SecurityAction.LinkDemand")) End Sub + + + Public Sub PrincipalPermissionAttribute_UserDefinedWithOptionalParameterInCtor() + Dim source = + + + Public Shared Sub Main() + End Sub +End Class +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics( + ~~~~~~~~~~~~~~~~~~~ +]]>) + End Sub + Public Sub SuppressUnmanagedCodeSecurityAttribute() @@ -4268,6 +4499,36 @@ BC30662: Attribute 'ClassInterfaceAttribute' cannot be applied to 'InvalidTarget ]]>) End Sub + + Public Sub TestClassInterfaceAttribute_UserDefinedWithOptionalParameterInCtor() + Dim source = + + +Public Class InvalidClass +End Class +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics( + ~~~~~~~~~~~~~~ +]]>) + End Sub #End Region #Region "InterfaceTypeAttribute, TypeLibTypeAttribute" @@ -4370,6 +4631,37 @@ BC30662: Attribute 'InterfaceTypeAttribute' cannot be applied to 'InvalidTarget' ]]>) End Sub + + Public Sub TestInterfaceTypeAttribute_UserDefinedWithOptionalParameterInCtor() + Dim source = + + +Public Interface InvalidInterface1 +End Interface +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics( + ~~~~~~~~~~~~~ +]]>) + End Sub + Public Sub TestIsExtensibleInterface() @@ -4712,6 +5004,214 @@ BC30934: Conversion from 'String' to 'Integer' cannot occur in a constant expres ]]>) End Sub + + Public Sub TestTypeLibVersionAttribute_Invalid_03() + Dim source = + + ' Not valid. Both arguments are negative. + +Namespace System.Runtime.InteropServices + Public Class TypeLibVersionAttribute + Inherits Attribute + + Public Sub New(Optional major As Integer = -1, Optional minor As Integer = Integer.MinValue) + End Sub + End Class +End Namespace +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics( ' Not valid. Both arguments are negative. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BC30127: Attribute 'TypeLibVersionAttribute' is not valid: Incorrect argument value. + ' Not valid. Both arguments are negative. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +]]>) + End Sub + + + Public Sub TestTypeLibVersionAttribute_Invalid_04() + Dim source = + + ' Not valid. minor is negative. + +Namespace System.Runtime.InteropServices + Public Class TypeLibVersionAttribute + Inherits Attribute + + Public Sub New(Optional major As Integer = -1, Optional minor As Integer = Integer.MinValue) + End Sub + End Class +End Namespace +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics( ' Not valid. minor is negative. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +]]>) + End Sub + + + Public Sub TestTypeLibVersionAttribute_Invalid_05() + Dim source = + + ' Not valid. Both arguments are negative. + +Namespace System.Runtime.InteropServices + Public Class TypeLibVersionAttribute + Inherits Attribute + + Public Sub New(Optional major As Integer = -1, Optional minor As Integer = Integer.MinValue) + End Sub + End Class +End Namespace +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics( ' Not valid. Both arguments are negative. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BC30127: Attribute 'TypeLibVersionAttribute' is not valid: Incorrect argument value. + ' Not valid. Both arguments are negative. + ~~ +]]>) + End Sub + + + Public Sub TestTypeLibVersionAttribute_Invalid_06() + Dim source = + + ' Not valid. Both arguments are negative. + +Namespace System.Runtime.InteropServices + Public Class TypeLibVersionAttribute + Inherits Attribute + + Public Sub New(Optional major As Integer = -1, Optional minor As Integer = Integer.MinValue) + End Sub + End Class +End Namespace +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics( ' Not valid. Both arguments are negative. + ~~ +BC30127: Attribute 'TypeLibVersionAttribute' is not valid: Incorrect argument value. + ' Not valid. Both arguments are negative. + ~~ +]]>) + End Sub + + + Public Sub TestTypeLibVersionAttribute_Invalid_07() + Dim source = + + ' Not valid. major is negative. + +Namespace System.Runtime.InteropServices + Public Class TypeLibVersionAttribute + Inherits Attribute + + Public Sub New(Optional major As Integer = -1, Optional minor As Integer = Integer.MinValue) + End Sub + End Class +End Namespace +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics( ' Not valid. major is negative. + ~~ +]]>) + End Sub + + + Public Sub TestTypeLibVersionAttribute_Invalid_08() + Dim source = + + ' Not valid. minor is negative. + +Namespace System.Runtime.InteropServices + Public Class TypeLibVersionAttribute + Inherits Attribute + + Public Sub New(Optional major As Integer = -1, Optional minor As Integer = Integer.MinValue) + End Sub + End Class +End Namespace +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics( ' Not valid. minor is negative. + ~~ +]]>) + End Sub + + + Public Sub TestTypeLibVersionAttribute_Valid_UserDefinedAttribute() + Dim source = + + + +Namespace System.Runtime.InteropServices + Public Class TypeLibVersionAttribute + Inherits Attribute + + Public Sub New(Optional major As Integer = -1, Optional minor As Integer = Integer.MinValue) + End Sub + End Class +End Namespace +]]> + + + + Dim comp = CreateCompilationWithMscorlib40(source) + comp.AssertTheseDiagnostics() + End Sub + #End Region #Region "ComCompatibleVersionAttribute" @@ -6676,5 +7176,36 @@ BC30127: Attribute 'StructLayoutAttribute' is not valid: Incorrect argument valu ]]> ) End Sub + + + Public Sub TestGuidAttribute() + Dim source = + + +Public Class AClass +End Class +]]> + + + + Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime(source) + compilation.AssertTheseDiagnostics( + ~~~~ +]]>) + End Sub End Class End Namespace diff --git a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs deleted file mode 100644 index b072df403dae2..0000000000000 --- a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.BraceMatching; -using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.LanguageServices; -using Microsoft.CodeAnalysis.EmbeddedLanguages.Json; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.Editor.CSharp.EmbeddedLanguages -{ - [ExportEmbeddedLanguageBraceMatcherInternal( - PredefinedEmbeddedLanguageBraceMatcherNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] - internal sealed class CSharpJsonEmbeddedLanguageBraceMatcher : - AbstractJsonEmbeddedLanguageBraceMatcher - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpJsonEmbeddedLanguageBraceMatcher() - : base(CSharpEmbeddedLanguagesProvider.Info) - { - } - } -} diff --git a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs deleted file mode 100644 index 500a8c69f9229..0000000000000 --- a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.BraceMatching; -using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.LanguageServices; -using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.Editor.CSharp.EmbeddedLanguages -{ - [ExportEmbeddedLanguageBraceMatcherInternal( - PredefinedEmbeddedLanguageBraceMatcherNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] - internal sealed class CSharpRegexEmbeddedLanguageBraceMatcher : - AbstractRegexEmbeddedLanguageBraceMatcher - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpRegexEmbeddedLanguageBraceMatcher() - : base(CSharpEmbeddedLanguagesProvider.Info) - { - } - } -} diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs index f12e1b4de50a6..c000f73e15c85 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs @@ -1063,9 +1063,9 @@ public interface I1 protected void M01(); } -class C1 : [|I1|] +class C1 : I1 { - public void M01() {} + public void [|M01|]() {} } ", expected: LanguageVersion.CSharp10, diff --git a/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs b/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs index 3d9e379de85bc..8fe9fde58c357 100644 --- a/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs +++ b/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs @@ -2,9 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Immutable; -using System.Composition; using Microsoft.CodeAnalysis.EmbeddedLanguages; namespace Microsoft.CodeAnalysis.BraceMatching @@ -12,57 +9,18 @@ namespace Microsoft.CodeAnalysis.BraceMatching /// /// Use this attribute to export a . /// - [MetadataAttribute] - [AttributeUsage(AttributeTargets.Class)] - internal class ExportEmbeddedLanguageBraceMatcherAttribute : ExportAttribute + internal class ExportEmbeddedLanguageBraceMatcherAttribute : ExportEmbeddedLanguageFeatureServiceAttribute { - /// - /// Name of the classifier. - /// - public string Name { get; } - - /// - /// Name of the containing language hosting the embedded language. e.g. C# or VB. - /// - public string Language { get; } - - /// - /// Identifiers in code (or StringSyntaxAttribute) used to identify an embedded language string. For example - /// Regex or Json. - /// - /// This can be used to find usages of an embedded language using a comment marker like // - /// lang=regex or passed to a symbol annotated with [StringSyntaxAttribyte("Regex")]. The identifier - /// is case sensitive for the StringSyntaxAttribute, and case insensitive for the comment. - /// - public string[] Identifiers { get; } - public ExportEmbeddedLanguageBraceMatcherAttribute( - string name, string language, params string[] identifiers) - : base(typeof(IEmbeddedLanguageBraceMatcher)) + string name, string[] languages, params string[] identifiers) + : this(name, languages, supportsUnannotatedAPIs: false, identifiers) { - Name = name ?? throw new ArgumentNullException(nameof(name)); - Language = language ?? throw new ArgumentNullException(nameof(language)); - Identifiers = identifiers ?? throw new ArgumentNullException(nameof(identifiers)); } - } - /// - /// Internal version of . Used so we can allow regex/json - /// to still light up on legacy APIs not using the new [StringSyntax] attribute the runtime added. For public - /// extensions that's the only mechanism we support. - /// - [MetadataAttribute] - [AttributeUsage(AttributeTargets.Class)] - internal sealed class ExportEmbeddedLanguageBraceMatcherInternalAttribute : ExportEmbeddedLanguageBraceMatcherAttribute - { - /// - public bool SupportsUnannotatedAPIs { get; } - - public ExportEmbeddedLanguageBraceMatcherInternalAttribute( - string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) - : base(name, language, identifiers) + public ExportEmbeddedLanguageBraceMatcherAttribute( + string name, string[] languages, bool supportsUnannotatedAPIs, params string[] identifiers) + : base(typeof(IEmbeddedLanguageBraceMatcher), name, languages, supportsUnannotatedAPIs, identifiers) { - SupportsUnannotatedAPIs = supportsUnannotatedAPIs; } } } diff --git a/src/EditorFeatures/Core/BraceMatching/PredefinedEmbeddedLanguageBraceMatcherNames.cs b/src/EditorFeatures/Core/BraceMatching/PredefinedEmbeddedLanguageBraceMatcherNames.cs deleted file mode 100644 index 48ab7824ea75f..0000000000000 --- a/src/EditorFeatures/Core/BraceMatching/PredefinedEmbeddedLanguageBraceMatcherNames.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CodeAnalysis.BraceMatching -{ - internal static class PredefinedEmbeddedLanguageBraceMatcherNames - { - public const string Regex = nameof(Regex); - - public const string Json = nameof(Json); - } -} diff --git a/src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonEmbeddedLanguageBraceMatcher.cs b/src/EditorFeatures/Core/EmbeddedLanguages/Json/JsonBraceMatcher.cs similarity index 84% rename from src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonEmbeddedLanguageBraceMatcher.cs rename to src/EditorFeatures/Core/EmbeddedLanguages/Json/JsonBraceMatcher.cs index 631b407a2f847..98ca3effb4f6b 100644 --- a/src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonEmbeddedLanguageBraceMatcher.cs +++ b/src/EditorFeatures/Core/EmbeddedLanguages/Json/JsonBraceMatcher.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; +using System.Composition; using System.Threading; using Microsoft.CodeAnalysis.BraceMatching; using Microsoft.CodeAnalysis.Editor; @@ -10,6 +12,8 @@ using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json; using Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageServices; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json { @@ -18,12 +22,18 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json /// /// Brace matcher impl for embedded json strings. /// - internal abstract class AbstractJsonEmbeddedLanguageBraceMatcher : IEmbeddedLanguageBraceMatcher + [ExportEmbeddedLanguageBraceMatcher( + PredefinedEmbeddedLanguageNames.Json, + new[] { LanguageNames.CSharp, LanguageNames.VisualBasic }, + supportsUnannotatedAPIs: true, + "Json"), Shared] + internal sealed class JsonBraceMatcher : IEmbeddedLanguageBraceMatcher { - private readonly EmbeddedLanguageInfo _info; - - public AbstractJsonEmbeddedLanguageBraceMatcher(EmbeddedLanguageInfo info) - => _info = info; + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public JsonBraceMatcher() + { + } public BraceMatchingResult? FindBraces( Project project, @@ -36,7 +46,8 @@ public AbstractJsonEmbeddedLanguageBraceMatcher(EmbeddedLanguageInfo info) if (!options.HighlightingOptions.HighlightRelatedJsonComponentsUnderCursor) return null; - var detector = JsonLanguageDetector.GetOrCreate(semanticModel.Compilation, _info); + var info = project.GetRequiredLanguageService().EmbeddedLanguageInfo; + var detector = JsonLanguageDetector.GetOrCreate(semanticModel.Compilation, info); // We do support brace matching in strings that look very likely to be json, even if we aren't 100% certain // if it truly is json. diff --git a/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexEmbeddedLanguageBraceMatcher.cs b/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/RegexBraceMatcher.cs similarity index 88% rename from src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexEmbeddedLanguageBraceMatcher.cs rename to src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/RegexBraceMatcher.cs index 0a84d0168c2ab..ad557e7d64b1e 100644 --- a/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexEmbeddedLanguageBraceMatcher.cs +++ b/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/RegexBraceMatcher.cs @@ -4,12 +4,15 @@ using System; using System.Collections.Immutable; +using System.Composition; using System.Threading; using Microsoft.CodeAnalysis.BraceMatching; using Microsoft.CodeAnalysis.Editor; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.LanguageServices; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions { @@ -19,12 +22,18 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions /// /// Brace matching impl for embedded regex strings. /// - internal abstract class AbstractRegexEmbeddedLanguageBraceMatcher : IEmbeddedLanguageBraceMatcher + [ExportEmbeddedLanguageBraceMatcher( + PredefinedEmbeddedLanguageNames.Regex, + new[] { LanguageNames.CSharp, LanguageNames.VisualBasic }, + supportsUnannotatedAPIs: true, + "Regex", "Regexp"), Shared] + internal sealed class RegexBraceMatcher : IEmbeddedLanguageBraceMatcher { - private readonly EmbeddedLanguageInfo _info; - - protected AbstractRegexEmbeddedLanguageBraceMatcher(EmbeddedLanguageInfo info) - => _info = info; + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public RegexBraceMatcher() + { + } public BraceMatchingResult? FindBraces( Project project, @@ -37,7 +46,8 @@ protected AbstractRegexEmbeddedLanguageBraceMatcher(EmbeddedLanguageInfo info) if (!options.HighlightingOptions.HighlightRelatedRegexComponentsUnderCursor) return null; - var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, _info); + var info = project.GetRequiredLanguageService().EmbeddedLanguageInfo; + var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, info); var tree = detector.TryParseString(token, semanticModel, cancellationToken); return tree == null ? null : GetMatchingBraces(tree, position); diff --git a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb deleted file mode 100644 index a1ded57111aeb..0000000000000 --- a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb +++ /dev/null @@ -1,23 +0,0 @@ -' Licensed to the .NET Foundation under one or more agreements. -' The .NET Foundation licenses this file to you under the MIT license. -' See the LICENSE file in the project root for more information. - -Imports System.Composition -Imports Microsoft.CodeAnalysis.BraceMatching -Imports Microsoft.CodeAnalysis.EmbeddedLanguages.Json -Imports Microsoft.CodeAnalysis.Host.Mef -Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices - -Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EmbeddedLanguages - - Friend Class VisualBasicJsonEmbeddedLanguageBraceMatcher - Inherits AbstractJsonEmbeddedLanguageBraceMatcher - - - - Public Sub New() - MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) - End Sub - End Class -End Namespace diff --git a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb deleted file mode 100644 index 577db240cb023..0000000000000 --- a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb +++ /dev/null @@ -1,23 +0,0 @@ -' Licensed to the .NET Foundation under one or more agreements. -' The .NET Foundation licenses this file to you under the MIT license. -' See the LICENSE file in the project root for more information. - -Imports System.Composition -Imports Microsoft.CodeAnalysis.BraceMatching -Imports Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions -Imports Microsoft.CodeAnalysis.Host.Mef -Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices - -Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EmbeddedLanguages - - Friend Class VisualBasicRegexEmbeddedLanguageBraceMatcher - Inherits AbstractRegexEmbeddedLanguageBraceMatcher - - - - Public Sub New() - MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) - End Sub - End Class -End Namespace diff --git a/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs b/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs index 970e96da01e6a..729486de888cc 100644 --- a/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs +++ b/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs @@ -5,13 +5,17 @@ #nullable disable using System; +using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.LanguageServices; +using Microsoft.CodeAnalysis.CSharp.LanguageServices; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.DocumentHighlighting; +using Microsoft.CodeAnalysis.EmbeddedLanguages; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; @@ -22,7 +26,12 @@ internal class CSharpDocumentHighlightsService : AbstractDocumentHighlightsServi { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpDocumentHighlightsService() + public CSharpDocumentHighlightsService( + [ImportMany] IEnumerable> services) + : base(LanguageNames.CSharp, + CSharpEmbeddedLanguagesProvider.Info, + CSharpSyntaxKinds.Instance, + services) { } diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonEmbeddedLanguageClassifier.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonEmbeddedLanguageClassifier.cs deleted file mode 100644 index f17b7ebf38c61..0000000000000 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonEmbeddedLanguageClassifier.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Classification; -using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.LanguageServices; -using Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageServices; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.CSharp.Features.EmbeddedLanguages -{ - [ExportEmbeddedLanguageClassifierInternal( - PredefinedEmbeddedLanguageClassifierNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] - internal class CSharpJsonEmbeddedLanguageClassifier : AbstractJsonEmbeddedLanguageClassifier - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpJsonEmbeddedLanguageClassifier() - : base(CSharpEmbeddedLanguagesProvider.Info) - { - } - } -} diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs deleted file mode 100644 index 929b2af473c16..0000000000000 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Classification; -using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.LanguageServices; -using Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.LanguageServices; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.CSharp.Features.EmbeddedLanguages -{ - // Order regex classification before json classification. Json lights up on probable-json strings, but we don't - // want that to happen for APIs that are certain to be another language like Regex. - [ExtensionOrder(Before = PredefinedEmbeddedLanguageClassifierNames.Json)] - [ExportEmbeddedLanguageClassifierInternal( - PredefinedEmbeddedLanguageClassifierNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] - internal class CSharpRegexEmbeddedLanguageClassifier : AbstractRegexEmbeddedLanguageClassifier - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpRegexEmbeddedLanguageClassifier() - : base(CSharpEmbeddedLanguagesProvider.Info) - { - } - } -} diff --git a/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs b/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs index 64a1da145f1b8..d3e7679e64fd8 100644 --- a/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs @@ -11,7 +11,6 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.EmbeddedLanguages; using Microsoft.CodeAnalysis.ErrorReporting; -using Microsoft.CodeAnalysis.Features.EmbeddedLanguages; using Microsoft.CodeAnalysis.FindSymbols; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.PooledObjects; @@ -21,8 +20,19 @@ namespace Microsoft.CodeAnalysis.DocumentHighlighting { - internal abstract partial class AbstractDocumentHighlightsService : IDocumentHighlightsService + internal abstract partial class AbstractDocumentHighlightsService : + AbstractEmbeddedLanguageFeatureService, + IDocumentHighlightsService { + protected AbstractDocumentHighlightsService( + string languageName, + EmbeddedLanguageInfo info, + ISyntaxKinds syntaxKinds, + IEnumerable> allServices) + : base(languageName, info, syntaxKinds, allServices) + { + } + public async Task> GetDocumentHighlightsAsync( Document document, int position, IImmutableSet documentsToSearch, HighlightingOptions options, CancellationToken cancellationToken) { @@ -53,14 +63,13 @@ public async Task> GetDocumentHighlightsAsync private async Task> GetDocumentHighlightsInCurrentProcessAsync( Document document, int position, IImmutableSet documentsToSearch, HighlightingOptions options, CancellationToken cancellationToken) { - var result = await TryGetEmbeddedLanguageHighlightsAsync( - document, position, documentsToSearch, options, cancellationToken).ConfigureAwait(false); + var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); + var result = TryGetEmbeddedLanguageHighlights(document, semanticModel, position, options, cancellationToken); if (!result.IsDefaultOrEmpty) return result; var solution = document.Project.Solution; - var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var symbol = await SymbolFinder.FindSymbolAtPositionAsync( semanticModel, position, solution.Workspace, cancellationToken).ConfigureAwait(false); if (symbol == null) @@ -80,26 +89,18 @@ private async Task> GetDocumentHighlightsInCu return tags; } - private static async Task> TryGetEmbeddedLanguageHighlightsAsync( - Document document, int position, IImmutableSet documentsToSearch, HighlightingOptions options, CancellationToken cancellationToken) + private ImmutableArray TryGetEmbeddedLanguageHighlights( + Document document, SemanticModel semanticModel, int position, HighlightingOptions options, CancellationToken cancellationToken) { - var languagesProvider = document.GetLanguageService(); - if (languagesProvider != null) + var root = semanticModel.SyntaxTree.GetRoot(cancellationToken); + var token = root.FindToken(position); + var embeddedHighlightsServices = this.GetServices(semanticModel, token, cancellationToken); + foreach (var service in embeddedHighlightsServices) { - foreach (var language in languagesProvider.Languages) - { - var highlighter = (language as IEmbeddedLanguageFeatures)?.DocumentHighlightsService; - if (highlighter != null) - { - var highlights = await highlighter.GetDocumentHighlightsAsync( - document, position, documentsToSearch, options, cancellationToken).ConfigureAwait(false); - - if (!highlights.IsDefaultOrEmpty) - { - return highlights; - } - } - } + var result = service.Value.GetDocumentHighlights( + document, semanticModel, token, position, options, cancellationToken); + if (!result.IsDefaultOrEmpty) + return result; } return default; @@ -116,7 +117,7 @@ private async Task> GetTagsForReferencedSymbo { var progress = new StreamingProgressCollector(); - var options = FindSymbols.FindReferencesSearchOptions.GetFeatureOptionsForStartingSymbol(symbol); + var options = FindReferencesSearchOptions.GetFeatureOptionsForStartingSymbol(symbol); await SymbolFinder.FindReferencesAsync( symbol, document.Project.Solution, progress, documentsToSearch, options, cancellationToken).ConfigureAwait(false); diff --git a/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs b/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs new file mode 100644 index 0000000000000..93eb0ef2f21a1 --- /dev/null +++ b/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.CodeAnalysis.EmbeddedLanguages; + +namespace Microsoft.CodeAnalysis.DocumentHighlighting +{ + /// + /// Use this attribute to export a . + /// + internal class ExportEmbeddedLanguageDocumentHighlighterAttribute : ExportEmbeddedLanguageFeatureServiceAttribute + { + public ExportEmbeddedLanguageDocumentHighlighterAttribute( + string name, string[] languages, params string[] identifiers) + : this(name, languages, supportsUnannotatedAPIs: false, identifiers) + { + } + + public ExportEmbeddedLanguageDocumentHighlighterAttribute( + string name, string[] languages, bool supportsUnannotatedAPIs, params string[] identifiers) + : base(typeof(IEmbeddedLanguageDocumentHighlighter), name, languages, supportsUnannotatedAPIs, identifiers) + { + } + } +} diff --git a/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlighter.cs b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlighter.cs new file mode 100644 index 0000000000000..5d7e6fba9253b --- /dev/null +++ b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlighter.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using System.Threading; +using Microsoft.CodeAnalysis.EmbeddedLanguages; + +namespace Microsoft.CodeAnalysis.DocumentHighlighting +{ + /// + internal interface IEmbeddedLanguageDocumentHighlighter : IEmbeddedLanguageFeatureService + { + /// + ImmutableArray GetDocumentHighlights( + Document document, + SemanticModel semanticModel, + SyntaxToken token, + int position, + HighlightingOptions options, + CancellationToken cancellationToken); + } +} diff --git a/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguagesFeaturesProvider.cs b/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguagesFeaturesProvider.cs index 30277435bc2bf..5b5387ef0c97f 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguagesFeaturesProvider.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguagesFeaturesProvider.cs @@ -18,6 +18,7 @@ internal abstract class AbstractEmbeddedLanguageFeaturesProvider : AbstractEmbed public override ImmutableArray Languages { get; } protected AbstractEmbeddedLanguageFeaturesProvider(EmbeddedLanguageInfo info) + : base(info) { Languages = ImmutableArray.Create( new DateAndTimeEmbeddedLanguageFeatures(info), diff --git a/src/Features/Core/Portable/EmbeddedLanguages/IEmbeddedLanguageFeatures.cs b/src/Features/Core/Portable/EmbeddedLanguages/IEmbeddedLanguageFeatures.cs index e59d78437770e..5864f01b91d9b 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/IEmbeddedLanguageFeatures.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/IEmbeddedLanguageFeatures.cs @@ -13,11 +13,6 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages /// internal interface IEmbeddedLanguageFeatures : IEmbeddedLanguage { - /// - /// A optional highlighter that can highlight spans for an embedded language string. - /// - IDocumentHighlightsService? DocumentHighlightsService { get; } - /// /// Completion provider that can provide completion items for this /// specific embedded language. diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonEmbeddedLanguageClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonClassifier.cs similarity index 89% rename from src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonEmbeddedLanguageClassifier.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonClassifier.cs index 514a909bae8b0..8ae6ca955f550 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonEmbeddedLanguageClassifier.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonClassifier.cs @@ -2,10 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; +using System.Composition; using Microsoft.CodeAnalysis.Classification; using Microsoft.CodeAnalysis.EmbeddedLanguages; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; +using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageServices { @@ -17,27 +21,33 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageService /// /// Classifier impl for embedded json strings. /// - internal abstract class AbstractJsonEmbeddedLanguageClassifier : IEmbeddedLanguageClassifier + [ExportEmbeddedLanguageClassifier( + PredefinedEmbeddedLanguageNames.Json, + new[] { LanguageNames.CSharp, LanguageNames.VisualBasic }, + supportsUnannotatedAPIs: true, "Json"), Shared] + internal sealed class JsonClassifier : IEmbeddedLanguageClassifier { private static readonly ObjectPool s_visitorPool = new(() => new Visitor()); - private readonly EmbeddedLanguageInfo _info; - public AbstractJsonEmbeddedLanguageClassifier(EmbeddedLanguageInfo info) + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public JsonClassifier() { - _info = info; } public void RegisterClassifications(EmbeddedLanguageClassificationContext context) { + var info = context.Project.GetRequiredLanguageService().EmbeddedLanguageInfo; + var token = context.SyntaxToken; - if (!_info.IsAnyStringLiteral(token.RawKind)) + if (!info.IsAnyStringLiteral(token.RawKind)) return; if (!context.Options.ColorizeJsonPatterns) return; var semanticModel = context.SemanticModel; - var detector = JsonLanguageDetector.GetOrCreate(semanticModel.Compilation, _info); + var detector = JsonLanguageDetector.GetOrCreate(semanticModel.Compilation, info); // We do support json classification in strings that look very likely to be json, even if we aren't 100% // certain if it truly is json. diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonEmbeddedLanguage.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonEmbeddedLanguage.cs index 35fe94a28c045..8bfd3b49ceb1e 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonEmbeddedLanguage.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonEmbeddedLanguage.cs @@ -9,9 +9,6 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageService { internal class JsonEmbeddedLanguage : IEmbeddedLanguageFeatures { - // No document-highlights for embedded json currently. - public IDocumentHighlightsService? DocumentHighlightsService => null; - // No completion for embedded json currently. public EmbeddedLanguageCompletionProvider? CompletionProvider => null; } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexEmbeddedLanguageClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs similarity index 93% rename from src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexEmbeddedLanguageClassifier.cs rename to src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs index 1a66b8761ce6b..00c5c0a280d05 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexEmbeddedLanguageClassifier.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs @@ -2,11 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; +using System.Composition; using Microsoft.CodeAnalysis.Classification; using Microsoft.CodeAnalysis.EmbeddedLanguages; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; +using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.LanguageServices { @@ -18,21 +22,27 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.L /// /// Classifier impl for embedded regex strings. /// - internal abstract class AbstractRegexEmbeddedLanguageClassifier : IEmbeddedLanguageClassifier + [ExtensionOrder(Before = PredefinedEmbeddedLanguageNames.Json)] + [ExportEmbeddedLanguageClassifier( + PredefinedEmbeddedLanguageNames.Regex, + new[] { LanguageNames.CSharp, LanguageNames.VisualBasic }, + supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] + internal sealed class RegexClassifier : IEmbeddedLanguageClassifier { private static readonly ObjectPool s_visitorPool = SharedPools.Default(); - private readonly EmbeddedLanguageInfo _info; - - protected AbstractRegexEmbeddedLanguageClassifier(EmbeddedLanguageInfo info) + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public RegexClassifier() { - _info = info; } public void RegisterClassifications(EmbeddedLanguageClassificationContext context) { + var info = context.Project.GetRequiredLanguageService().EmbeddedLanguageInfo; + var token = context.SyntaxToken; - if (!_info.IsAnyStringLiteral(token.RawKind)) + if (!info.IsAnyStringLiteral(token.RawKind)) return; if (!context.Options.ColorizeRegexPatterns) @@ -41,7 +51,7 @@ public void RegisterClassifications(EmbeddedLanguageClassificationContext contex var semanticModel = context.SemanticModel; var cancellationToken = context.CancellationToken; - var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, _info); + var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, info); var tree = detector.TryParseString(token, semanticModel, cancellationToken); if (tree == null) return; diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs similarity index 78% rename from src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs rename to src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs index 00753e8bbfa32..e0810d43b0a6e 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs @@ -2,38 +2,46 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Immutable; +using System.Composition; using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.DocumentHighlighting; +using Microsoft.CodeAnalysis.EmbeddedLanguages; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.LanguageServices { using RegexToken = EmbeddedSyntaxToken; - internal sealed class RegexDocumentHighlightsService : IDocumentHighlightsService + [ExportEmbeddedLanguageDocumentHighlighter( + PredefinedEmbeddedLanguageNames.Regex, + new[] { LanguageNames.CSharp, LanguageNames.VisualBasic }, + supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] + internal sealed class RegexDocumentHighlighter : IEmbeddedLanguageDocumentHighlighter { - private readonly RegexEmbeddedLanguage _language; - - public RegexDocumentHighlightsService(RegexEmbeddedLanguage language) - => _language = language; + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public RegexDocumentHighlighter() + { + } - public async Task> GetDocumentHighlightsAsync( - Document document, int position, IImmutableSet documentsToSearch, HighlightingOptions options, CancellationToken cancellationToken) + public ImmutableArray GetDocumentHighlights( + Document document, SemanticModel semanticModel, SyntaxToken token, int position, HighlightingOptions options, CancellationToken cancellationToken) { if (!options.HighlightRelatedRegexComponentsUnderCursor) - { return default; - } - var tree = await _language.TryGetTreeAtPositionAsync(document, position, cancellationToken).ConfigureAwait(false); + var info = document.GetRequiredLanguageService().EmbeddedLanguageInfo; + + var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, info); + var tree = detector.TryParseString(token, semanticModel, cancellationToken); + return tree == null ? default : ImmutableArray.Create(new DocumentHighlights(document, GetHighlights(tree, position))); @@ -115,7 +123,7 @@ private static RegexToken GetCaptureToken(RegexEscapeNode node) _ => throw new InvalidOperationException(), }; - private RegexEscapeNode FindReferenceNode(RegexNode node, VirtualChar virtualChar) + private RegexEscapeNode? FindReferenceNode(RegexNode node, VirtualChar virtualChar) { if (node.Kind is RegexKind.BackreferenceEscape or RegexKind.CaptureEscape or diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexEmbeddedLanguage.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexEmbeddedLanguage.cs index d8d7fb443f444..2c96c08d1a21d 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexEmbeddedLanguage.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexEmbeddedLanguage.cs @@ -5,9 +5,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Completion.Providers; -using Microsoft.CodeAnalysis.DocumentHighlighting; using Microsoft.CodeAnalysis.EmbeddedLanguages; using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.LanguageServices { @@ -17,7 +17,6 @@ internal class RegexEmbeddedLanguage : IEmbeddedLanguageFeatures private readonly AbstractEmbeddedLanguageFeaturesProvider _provider; - public IDocumentHighlightsService? DocumentHighlightsService { get; } public EmbeddedLanguageCompletionProvider CompletionProvider { get; } public RegexEmbeddedLanguage( @@ -28,18 +27,16 @@ public RegexEmbeddedLanguage( _provider = provider; - DocumentHighlightsService = new RegexDocumentHighlightsService(this); CompletionProvider = new RegexEmbeddedCompletionProvider(this); } -#nullable disable internal async Task<(RegexTree tree, SyntaxToken token)> TryGetTreeAndTokenAtPositionAsync( Document document, int position, CancellationToken cancellationToken) { - var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var token = root.FindToken(position); - var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); + var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, this.Info); var tree = detector.TryParseString(token, semanticModel, cancellationToken); return tree == null ? default : (tree, token); diff --git a/src/Features/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb b/src/Features/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb index 9ba01d722e9b9..280a9004efa96 100644 --- a/src/Features/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb +++ b/src/Features/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb @@ -4,7 +4,10 @@ Imports System.Composition Imports Microsoft.CodeAnalysis.DocumentHighlighting +Imports Microsoft.CodeAnalysis.EmbeddedLanguages Imports Microsoft.CodeAnalysis.Host.Mef +Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices +Imports Microsoft.CodeAnalysis.VisualBasic.LanguageServices Namespace Microsoft.CodeAnalysis.VisualBasic.DocumentHighlighting @@ -13,7 +16,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.DocumentHighlighting - Public Sub New() + Public Sub New( + services As IEnumerable(Of Lazy(Of IEmbeddedLanguageDocumentHighlighter, EmbeddedLanguageMetadata))) + MyBase.New( + LanguageNames.VisualBasic, + VisualBasicEmbeddedLanguagesProvider.Info, + VisualBasicSyntaxKinds.Instance, + services) End Sub End Class End Namespace diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb deleted file mode 100644 index 88566a89e9ccb..0000000000000 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb +++ /dev/null @@ -1,23 +0,0 @@ -' Licensed to the .NET Foundation under one or more agreements. -' The .NET Foundation licenses this file to you under the MIT license. -' See the LICENSE file in the project root for more information. - -Imports System.Composition -Imports Microsoft.CodeAnalysis.Classification -Imports Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageServices -Imports Microsoft.CodeAnalysis.Host.Mef -Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices - -Namespace Microsoft.CodeAnalysis.VisualBasic.Features.EmbeddedLanguages - - Friend Class VisualBasicJsonEmbeddedLanguageClassifier - Inherits AbstractJsonEmbeddedLanguageClassifier - - - - Public Sub New() - MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) - End Sub - End Class -End Namespace diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb deleted file mode 100644 index 847389b65f68e..0000000000000 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb +++ /dev/null @@ -1,26 +0,0 @@ -' Licensed to the .NET Foundation under one or more agreements. -' The .NET Foundation licenses this file to you under the MIT license. -' See the LICENSE file in the project root for more information. - -Imports System.Composition -Imports Microsoft.CodeAnalysis.Classification -Imports Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.LanguageServices -Imports Microsoft.CodeAnalysis.Host.Mef -Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices - -Namespace Microsoft.CodeAnalysis.VisualBasic.Features.EmbeddedLanguages - ' Order regex classification before json classification. Json lights up on probable-json strings, but we don't - ' want that to happen for APIs that are certain to be another language Like Regex. - - - Friend Class VisualBasicRegexEmbeddedLanguageClassifier - Inherits AbstractRegexEmbeddedLanguageClassifier - - - - Public Sub New() - MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) - End Sub - End Class -End Namespace diff --git a/src/Tools/BuildActionTelemetryTable/BuildActionTelemetryTable.csproj b/src/Tools/BuildActionTelemetryTable/BuildActionTelemetryTable.csproj index 2809fab12808d..eee1d352ffb39 100644 --- a/src/Tools/BuildActionTelemetryTable/BuildActionTelemetryTable.csproj +++ b/src/Tools/BuildActionTelemetryTable/BuildActionTelemetryTable.csproj @@ -2,7 +2,7 @@ Exe - net6.0-windows + net6.0 @@ -17,7 +17,7 @@ - + diff --git a/src/Tools/BuildActionTelemetryTable/Program.cs b/src/Tools/BuildActionTelemetryTable/Program.cs index 6b93c95f8a1d8..b9cf430ad0941 100644 --- a/src/Tools/BuildActionTelemetryTable/Program.cs +++ b/src/Tools/BuildActionTelemetryTable/Program.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Reflection; using System.Text; +using System.Text.RegularExpressions; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeRefactorings; @@ -31,263 +32,402 @@ public class Program "Microsoft.CodeAnalysis.CodeActions.CodeAction+NoChangeAction", "Microsoft.CodeAnalysis.CodeActions.CustomCodeActions+DocumentChangeAction", "Microsoft.CodeAnalysis.CodeActions.CustomCodeActions+SolutionChangeAction", + "Microsoft.CodeAnalysis.CodeStyle.AbstractCodeStyleProvider`2+CodeRefactoringProvider", }.ToImmutableHashSet(); private static ImmutableDictionary CodeActionDescriptionMap { get; } = new Dictionary() { + { "Microsoft.CodeAnalysis.CodeStyle.CSharpFormattingCodeFixProvider", "Formatting" }, + { "Microsoft.CodeAnalysis.DiagnosticComments.CodeFixes.CSharpAddDocCommentNodesCodeFixProvider", "Add Doc Comment Nodes" }, + { "Microsoft.CodeAnalysis.DiagnosticComments.CodeFixes.CSharpRemoveDocCommentNodeCodeFixProvider", "Remove Doc Comment Node" }, { "Microsoft.CodeAnalysis.CSharp.TypeStyle.UseExplicitTypeCodeFixProvider", "Use Explicit Type" }, { "Microsoft.CodeAnalysis.CSharp.TypeStyle.UseImplicitTypeCodeFixProvider", "Use Implicit Type" }, + { "Microsoft.CodeAnalysis.CSharp.MakeFieldReadonly.CSharpMakeFieldReadonlyCodeFixProvider", "Make Field Readonly" }, + { "Microsoft.CodeAnalysis.CSharp.UseInterpolatedVerbatimString.CSharpUseInterpolatedVerbatimStringCodeFixProvider", "Use Interpolated Verbatim String" }, + { "Microsoft.CodeAnalysis.CSharp.UnsealClass.CSharpUnsealClassCodeFixProvider", "Unseal Class" }, + { "Microsoft.CodeAnalysis.CSharp.MakeTypeAbstract.CSharpMakeTypeAbstractCodeFixProvider", "Make Type Abstract" }, + { "Microsoft.CodeAnalysis.CSharp.MakeMemberStatic.CSharpMakeMemberStaticCodeFixProvider", "Make Member Static" }, + { "Microsoft.CodeAnalysis.CSharp.DisambiguateSameVariable.CSharpDisambiguateSameVariableCodeFixProvider", "Disambiguate Same Variable" }, + { "Microsoft.CodeAnalysis.CSharp.AliasAmbiguousType.CSharpAliasAmbiguousTypeCodeFixProvider", "Alias Ambiguous Type" }, + { "Microsoft.CodeAnalysis.CSharp.AddObsoleteAttribute.CSharpAddObsoleteAttributeCodeFixProvider", "Add Obsolete Attribute" }, + { "Microsoft.CodeAnalysis.CSharp.UseUTF8StringLiteral.UseUTF8StringLiteralCodeFixProvider", "Use UTF 8 String Literal" }, { "Microsoft.CodeAnalysis.CSharp.UseSimpleUsingStatement.UseSimpleUsingStatementCodeFixProvider", "Use Simple Using Statement" }, - { "Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider", "Use 'Is Null' Check" }, - { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseIndexOperatorCodeFixProvider", "Use Index Operator" }, - { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseRangeOperatorCodeFixProvider", "Use Range Operator" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternCombinators.CSharpUsePatternCombinatorsCodeFixProvider", "Use Pattern Combinators" }, + { "Microsoft.CodeAnalysis.CSharp.UseObjectInitializer.CSharpUseObjectInitializerCodeFixProvider", "Use Object Initializer" }, + { "Microsoft.CodeAnalysis.CSharp.UseNullPropagation.CSharpUseNullPropagationCodeFixProvider", "Use Null Propagation" }, + { "Microsoft.CodeAnalysis.CSharp.UseTupleSwap.CSharpUseTupleSwapCodeFixProvider", "Use Tuple Swap" }, + { "Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider", "Use Is Null Check: For Cast And Equality Operator" }, + { "Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider", "Use Is Null Check: For Reference Equals" }, + { "Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseNullCheckOverTypeCheckCodeFixProvider", "Use Is Null Check: Use Null Check Over Type Check" }, + { "Microsoft.CodeAnalysis.CSharp.UseInferredMemberName.CSharpUseInferredMemberNameCodeFixProvider", "Use Inferred Member Name" }, + { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseIndexOperatorCodeFixProvider", "Use Index Or Range Operator: Use Index Operator" }, + { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseRangeOperatorCodeFixProvider", "Use Index Or Range Operator: Use Range Operator" }, { "Microsoft.CodeAnalysis.CSharp.UseImplicitObjectCreation.CSharpUseImplicitObjectCreationCodeFixProvider", "Use Implicit Object Creation" }, + { "Microsoft.CodeAnalysis.CSharp.UseCollectionInitializer.CSharpUseCollectionInitializerCodeFixProvider", "Use Collection Initializer" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnusedParametersAndValues.CSharpRemoveUnusedValuesCodeFixProvider", "Remove Unused Parameters And Values: Remove Unused Values" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnusedMembers.CSharpRemoveUnusedMembersCodeFixProvider", "Remove Unused Members" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryImports.CSharpRemoveUnnecessaryImportsCodeFixProvider", "Remove Unnecessary Imports" }, { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryCast.CSharpRemoveUnnecessaryCastCodeFixProvider", "Remove Unnecessary Cast" }, + { "Microsoft.CodeAnalysis.CSharp.QualifyMemberAccess.CSharpQualifyMemberAccessCodeFixProvider", "Qualify Member Access" }, { "Microsoft.CodeAnalysis.CSharp.UseDefaultLiteral.CSharpUseDefaultLiteralCodeFixProvider", "Use Default Literal" }, { "Microsoft.CodeAnalysis.CSharp.UseDeconstruction.CSharpUseDeconstructionCodeFixProvider", "Use Deconstruction" }, - { "Microsoft.CodeAnalysis.CSharp.UseCompoundAssignment.CSharpUseCompoundCoalesceAssignmentCodeFixProvider", "Use Compound Assignment" }, + { "Microsoft.CodeAnalysis.CSharp.UseConditionalExpression.CSharpUseConditionalExpressionForAssignmentCodeFixProvider", "Use Conditional Expression: For Assignment" }, + { "Microsoft.CodeAnalysis.CSharp.UseConditionalExpression.CSharpUseConditionalExpressionForReturnCodeFixProvider", "Use Conditional Expression: For Return" }, + { "Microsoft.CodeAnalysis.CSharp.UseCompoundAssignment.CSharpUseCompoundAssignmentCodeFixProvider", "Use Compound Assignment" }, + { "Microsoft.CodeAnalysis.CSharp.UseCompoundAssignment.CSharpUseCompoundCoalesceAssignmentCodeFixProvider", "Use Compound Assignment: Use Compound Coalesce Assignment" }, + { "Microsoft.CodeAnalysis.CSharp.SimplifyPropertyPattern.CSharpSimplifyPropertyPatternCodeFixProvider", "Simplify Property Pattern" }, + { "Microsoft.CodeAnalysis.CSharp.SimplifyLinqExpression.CSharpSimplifyLinqExpressionCodeFixProvider", "Simplify Linq Expression" }, + { "Microsoft.CodeAnalysis.CSharp.SimplifyInterpolation.CSharpSimplifyInterpolationCodeFixProvider", "Simplify Interpolation" }, { "Microsoft.CodeAnalysis.CSharp.RemoveUnreachableCode.CSharpRemoveUnreachableCodeCodeFixProvider", "Remove Unreachable Code" }, - { "Microsoft.CodeAnalysis.CSharp.MisplacedUsingDirectives.MisplacedUsingDirectivesCodeFixProvider+MoveMisplacedUsingsCodeAction", "Misplaced Using Directives" }, + { "Microsoft.CodeAnalysis.CSharp.PopulateSwitch.CSharpPopulateSwitchExpressionCodeFixProvider", "Populate Switch: Expression" }, + { "Microsoft.CodeAnalysis.CSharp.PopulateSwitch.CSharpPopulateSwitchStatementCodeFixProvider", "Populate Switch: Statement" }, + { "Microsoft.CodeAnalysis.CSharp.OrderModifiers.CSharpOrderModifiersCodeFixProvider", "Order Modifiers" }, + { "Microsoft.CodeAnalysis.CSharp.MisplacedUsingDirectives.MisplacedUsingDirectivesCodeFixProvider", "Misplaced Using Directives" }, { "Microsoft.CodeAnalysis.CSharp.MakeStructFieldsWritable.CSharpMakeStructFieldsWritableCodeFixProvider", "Make Struct Fields Writable" }, { "Microsoft.CodeAnalysis.CSharp.InvokeDelegateWithConditionalAccess.InvokeDelegateWithConditionalAccessCodeFixProvider", "Invoke Delegate With Conditional Access" }, { "Microsoft.CodeAnalysis.CSharp.InlineDeclaration.CSharpInlineDeclarationCodeFixProvider", "Inline Declaration" }, + { "Microsoft.CodeAnalysis.CSharp.FileHeaders.CSharpFileHeaderCodeFixProvider", "File Headers: File Header" }, { "Microsoft.CodeAnalysis.CSharp.ConvertSwitchStatementToExpression.ConvertSwitchStatementToExpressionCodeFixProvider", "Convert Switch Statement To Expression" }, - { "Microsoft.CodeAnalysis.CSharp.RemoveConfusingSuppression.CSharpRemoveConfusingSuppressionCodeFixProvider", "Remove Confusing Suppressino" }, - { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryDiscardDesignation.CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider", "Remove Unneccessary Discard Designation" }, - { "Microsoft.CodeAnalysis.CSharp.NewLines.EmbeddedStatementPlacement.EmbeddedStatementPlacementCodeFixProvider", "New Lines: Embedded Statement Placement" }, - { "Microsoft.CodeAnalysis.CSharp.NewLines.ConstructorInitializerPlacement.ConstructorInitializerPlacementCodeFixProvider", "New Lines: Constructor Initializer Placement" }, - { "Microsoft.CodeAnalysis.CSharp.NewLines.ConsecutiveBracePlacement.ConsecutiveBracePlacementCodeFixProvider", "New Lines: Consecutive Brace Placement" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveConfusingSuppression.CSharpRemoveConfusingSuppressionCodeFixProvider", "Remove Confusing Suppression" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryParentheses.CSharpRemoveUnnecessaryParenthesesCodeFixProvider", "Remove Unnecessary Parentheses" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryLambdaExpression.CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider", "Remove Unnecessary Lambda Expression" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryDiscardDesignation.CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider", "Remove Unnecessary Discard Designation" }, + { "Microsoft.CodeAnalysis.CSharp.NewLines.EmbeddedStatementPlacement.EmbeddedStatementPlacementCodeFixProvider", "Embedded Statement Placement" }, + { "Microsoft.CodeAnalysis.CSharp.NewLines.ConstructorInitializerPlacement.ConstructorInitializerPlacementCodeFixProvider", "Constructor Initializer Placement" }, + { "Microsoft.CodeAnalysis.CSharp.NewLines.ConsecutiveBracePlacement.ConsecutiveBracePlacementCodeFixProvider", "Consecutive Brace Placement" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertTypeOfToNameOf.CSharpConvertTypeOfToNameOfCodeFixProvider", "Convert Type Of To Name Of" }, + { "Microsoft.CodeAnalysis.CSharp.AddAccessibilityModifiers.CSharpAddAccessibilityModifiersCodeFixProvider", "Add Accessibility Modifiers" }, + { "Microsoft.CodeAnalysis.CSharp.Wrapping.CSharpWrappingCodeRefactoringProvider", "Wrapping (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckWithoutNameCodeFixProvider", "Use Pattern Matching: Is And Cast Check Without Name" }, { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpUseNotPatternCodeFixProvider", "Use Pattern Matching: Use Not Pattern" }, { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpAsAndNullCheckCodeFixProvider", "Use Pattern Matching: As And Null Check" }, { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckCodeFixProvider", "Use Pattern Matching: Is And Cast Check" }, - { "Microsoft.CodeAnalysis.CSharp.UsePatternCombinators.CSharpUsePatternCombinatorsCodeFixProvider", "Use Pattern Mathcing: Use Pattern Combinators" }, + { "Microsoft.CodeAnalysis.CSharp.UseNamedArguments.CSharpUseNamedArgumentsCodeRefactoringProvider", "Use Named Arguments (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.UseLocalFunction.CSharpUseLocalFunctionCodeFixProvider", "Use Local Function" }, { "Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyCodeRefactoringProvider", "Use Expression Body (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyCodeFixProvider", "Use Expression Body (Codefix)" }, - { "Microsoft.CodeAnalysis.CSharp.UseExpressionBodyForLambda.UseExpressionBodyForLambdaCodeStyleProvider", "Use Expression Body For Lambda" }, + { "Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyCodeFixProvider", "Use Expression Body" }, + { "Microsoft.CodeAnalysis.CSharp.UseExpressionBodyForLambda.UseExpressionBodyForLambdaCodeFixProvider", "Use Expression Body For Lambda" }, + { "Microsoft.CodeAnalysis.CSharp.UseExpressionBodyForLambda.UseExpressionBodyForLambdaCodeRefactoringProvider", "Use Expression Body For Lambda (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.UseExplicitTypeForConst.UseExplicitTypeForConstCodeFixProvider", "Use Explicit Type For Const" }, - { "Microsoft.CodeAnalysis.CSharp.ReverseForStatement.CSharpReverseForStatementCodeRefactoringProvider", "Reverse For Statement" }, + { "Microsoft.CodeAnalysis.CSharp.UseAutoProperty.CSharpUseAutoPropertyCodeFixProvider", "Use Auto Property" }, + { "Microsoft.CodeAnalysis.CSharp.UpgradeProject.CSharpUpgradeProjectCodeFixProvider", "Upgrade Project" }, + { "Microsoft.CodeAnalysis.CSharp.UpdateProjectToAllowUnsafe.CSharpUpdateProjectToAllowUnsafeCodeFixProvider", "Update Project To Allow Unsafe" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpMergeConsecutiveIfStatementsCodeRefactoringProvider", "Split Or Merge If Statements: Merge Consecutive If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpMergeNestedIfStatementsCodeRefactoringProvider", "Split Or Merge If Statements: Merge Nested If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Or Merge If Statements: Split Into Consecutive If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Or Merge If Statements: Split Into Nested If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.SpellCheck.CSharpSpellCheckCodeFixProvider", "Spell Check" }, + { "Microsoft.CodeAnalysis.CSharp.SimplifyTypeNames.SimplifyTypeNamesCodeFixProvider", "Simplify Type Names" }, + { "Microsoft.CodeAnalysis.CSharp.SimplifyThisOrMe.CSharpSimplifyThisOrMeCodeFixProvider", "Simplify This Or Me" }, + { "Microsoft.CodeAnalysis.CSharp.ReverseForStatement.CSharpReverseForStatementCodeRefactoringProvider", "Reverse For Statement (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ReplaceDocCommentTextWithTag.CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider", "Replace Doc Comment Text With Tag (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.ReplaceDefaultLiteral.CSharpReplaceDefaultLiteralCodeFixProvider", "Replace Default Literal" }, + { "Microsoft.CodeAnalysis.CSharp.ReplaceConditionalWithStatements.CSharpReplaceConditionalWithStatementsCodeRefactoringProvider", "Replace Conditional With Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnusedVariable.CSharpRemoveUnusedVariableCodeFixProvider", "Remove Unused Variable" }, { "Microsoft.CodeAnalysis.CSharp.RemoveUnusedLocalFunction.CSharpRemoveUnusedLocalFunctionCodeFixProvider", "Remove Unused Local Function" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveAsyncModifier.CSharpRemoveAsyncModifierCodeFixProvider", "Remove Async Modifier" }, + { "Microsoft.CodeAnalysis.CSharp.NameTupleElement.CSharpNameTupleElementCodeRefactoringProvider", "Name Tuple Element (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.MoveDeclarationNearReference.CSharpMoveDeclarationNearReferenceCodeRefactoringProvider", "Move Declaration Near Reference (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.MakeRefStruct.MakeRefStructCodeFixProvider", "Make Ref Struct" }, - { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticCodeFixProvider", "Make Local Function Static (CodeFix)" }, + { "Microsoft.CodeAnalysis.CSharp.MakeMethodSynchronous.CSharpMakeMethodSynchronousCodeFixProvider", "Make Method Synchronous" }, + { "Microsoft.CodeAnalysis.CSharp.MakeMethodAsynchronous.CSharpMakeMethodAsynchronousCodeFixProvider", "Make Method Asynchronous" }, + { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticCodeFixProvider", "Make Local Function Static" }, { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticCodeRefactoringProvider", "Make Local Function Static (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.PassInCapturedVariablesAsArgumentsCodeFixProvider", "Make Local Function Static Pass In Captured Variables As Arguments" }, - { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.AbstractChangeImplementionCodeRefactoringProvider", "Implement Interface" }, - { "Microsoft.CodeAnalysis.CSharp.DisambiguateSameVariable.CSharpDisambiguateSameVariableCodeFixProvider", "Disambiguate Same Variable" }, + { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.PassInCapturedVariablesAsArgumentsCodeFixProvider", "Make Local Function Static: Pass In Captured Variables As Arguments" }, + { "Microsoft.CodeAnalysis.CSharp.InvertLogical.CSharpInvertLogicalCodeRefactoringProvider", "Invert Logical (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.InvertIf.CSharpInvertIfCodeRefactoringProvider", "Invert If (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.InvertConditional.CSharpInvertConditionalCodeRefactoringProvider", "Invert Conditional (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.IntroduceVariable.CSharpIntroduceLocalForExpressionCodeRefactoringProvider", "Introduce Variable: Introduce Local For Expression (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.IntroduceVariable.CSharpIntroduceParameterCodeRefactoringProvider", "Introduce Variable: Introduce Parameter (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.IntroduceUsingStatement.CSharpIntroduceUsingStatementCodeRefactoringProvider", "Introduce Using Statement (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.InitializeParameter.CSharpAddParameterCheckCodeRefactoringProvider", "Initialize Parameter: Add Parameter Check (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.InitializeParameter.CSharpInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Parameter: Initialize Member From Parameter (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementExplicitlyCodeRefactoringProvider", "Implement Interface: Implement Explicitly (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementImplicitlyCodeRefactoringProvider", "Implement Interface: Implement Implicitly (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementInterfaceCodeFixProvider", "Implement Interface" }, + { "Microsoft.CodeAnalysis.CSharp.ImplementAbstractClass.CSharpImplementAbstractClassCodeFixProvider", "Implement Abstract Class" }, + { "Microsoft.CodeAnalysis.CSharp.GenerateVariable.CSharpGenerateVariableCodeFixProvider", "Generate Variable" }, + { "Microsoft.CodeAnalysis.CSharp.GenerateDefaultConstructors.CSharpGenerateDefaultConstructorsCodeFixProvider", "Generate Default Constructors" }, + { "Microsoft.CodeAnalysis.CSharp.GenerateConstructor.GenerateConstructorCodeFixProvider", "Generate Constructor" }, + { "Microsoft.CodeAnalysis.CSharp.GenerateConstructorFromMembers.CSharpGenerateConstructorFromMembersCodeRefactoringProvider", "Generate Constructor From Members (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.CSharpJsonDetectionCodeFixProvider", "Embedded Languages: Json Detection" }, { "Microsoft.CodeAnalysis.CSharp.Diagnostics.AddBraces.CSharpAddBracesCodeFixProvider", "Add Braces" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.AbstractConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider`1", "Convert Between Regular And Verbatim String" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseType.AbstractUseTypeCodeRefactoringProvider", "Use Type" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.LambdaSimplifier.LambdaSimplifierCodeRefactoringProvider", "Lambda Simplifier" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineTemporary.CSharpInlineTemporaryCodeRefactoringProvider", "Inline Temporary" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider", "Enable nullable" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ConvertLocalFunctionToMethod.CSharpConvertLocalFunctionToMethodCodeRefactoringProvider", "Convert Local Function To Method" }, - { "Microsoft.CodeAnalysis.CSharp.UseInterpolatedVerbatimString.CSharpUseInterpolatedVerbatimStringCodeFixProvider", "Use Interpolated Verbatim String" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.RemoveNewModifier.RemoveNewModifierCodeFixProvider", "Remove New Modifier" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.RemoveInKeyword.RemoveInKeywordCodeFixProvider", "Remove In Keyword" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertTupleToStruct.CSharpConvertTupleToStructCodeRefactoringProvider", "Convert Tuple To Struct (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToRawString.ConvertRegularStringToRawStringCodeRefactoringProvider", "Convert To Raw String: Convert Regular String To Raw String (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertConcatenationToInterpolatedStringRefactoringProvider", "Convert To Interpolated String: Convert Concatenation To Interpolated String (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert To Interpolated String: Convert Placeholder To Interpolated String (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeFixProvider", "Convert Program: Convert To Program Main" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeRefactoringProvider", "Convert Program: Convert To Program Main (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeFixProvider", "Convert Program: Convert To Top Level Statements" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeRefactoringProvider", "Convert Program: Convert To Top Level Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertNumericLiteral.CSharpConvertNumericLiteralCodeRefactoringProvider", "Convert Numeric Literal (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeRefactoringProvider", "Convert Namespace (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeFixProvider", "Convert Namespace" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertLinq.CSharpConvertLinqQueryToForEachProvider", "Convert Linq: Query To For Each" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertLinq.ConvertForEachToLinqQuery.CSharpConvertForEachToLinqQueryProvider", "Convert For Each To Linq Query" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertIfToSwitch.CSharpConvertIfToSwitchCodeRefactoringProvider", "Convert If To Switch (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertForToForEach.CSharpConvertForToForEachCodeRefactoringProvider", "Convert For To For Each (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertForEachToFor.CSharpConvertForEachToForCodeRefactoringProvider", "Convert For Each To For (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertCast.CSharpConvertDirectCastToTryCastCodeRefactoringProvider", "Convert Cast: Convert Direct Cast To Try Cast (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertCast.CSharpConvertTryCastToDirectCastCodeRefactoringProvider", "Convert Cast: Convert Try Cast To Direct Cast (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.ConvertBetweenRegularAndVerbatimInterpolatedStringCodeRefactoringProvider", "Convert Between Regular And Verbatim String: Convert Between Regular And Verbatim Interpolated String (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.ConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider", "Convert Between Regular And Verbatim String (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertAutoPropertyToFullProperty.CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider", "Convert Auto Property To Full Property (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousType.CSharpConvertAnonymousTypeToClassCodeRefactoringProvider", "Convert Anonymous Type: To Class (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousType.CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider", "Convert Anonymous Type: To Tuple (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConflictMarkerResolution.CSharpResolveConflictMarkerCodeFixProvider", "Conflict Marker Resolution: Resolve Conflict Marker" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseRecursivePatterns.UseRecursivePatternsCodeRefactoringProvider", "Use Recursive Patterns (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseImplicitType.UseImplicitTypeCodeRefactoringProvider", "Use Implicit Type (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseExplicitType.UseExplicitTypeCodeRefactoringProvider", "Use Explicit Type (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.SyncNamespace.CSharpSyncNamespaceCodeRefactoringProvider", "Sync Namespace (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.PullMemberUp.CSharpPullMemberUpCodeRefactoringProvider", "Pull Member Up (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.MoveStaticMembers.CSharpMoveStaticMembersRefactoringProvider", "Move Static Members (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineTemporary.CSharpInlineTemporaryCodeRefactoringProvider", "Inline Temporary (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineMethod.CSharpInlineMethodRefactoringProvider", "Inline Method (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ExtractClass.CSharpExtractClassCodeRefactoringProvider", "Extract Class (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider", "Enable Nullable (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ConvertLocalFunctionToMethod.CSharpConvertLocalFunctionToMethodCodeRefactoringProvider", "Convert Local Function To Method (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.AddMissingImports.CSharpAddMissingImportsRefactoringProvider", "Add Missing Imports (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.AddAwait.CSharpAddAwaitCodeRefactoringProvider", "Add Await (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.TransposeRecordKeyword.CSharpTransposeRecordKeywordCodeFixProvider", "Transpose Record Keyword" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.MatchFolderAndNamespace.CSharpChangeNamespaceToMatchFolderCodeFixProvider", "Match Folder And Namespace: Change Namespace To Match Folder" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.FixIncorrectConstraint.CSharpFixIncorrectConstraintCodeFixProvider", "Fix Incorrect Constraint" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.ForEachCast.CSharpForEachCastCodeFixProvider", "For Each Cast" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.DeclareAsNullable.CSharpDeclareAsNullableCodeFixProvider", "Declare As Nullable" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.MakeStatementAsynchronous.CSharpMakeStatementAsynchronousCodeFixProvider", "Make Statement Asynchronous" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator.CSharpAddYieldCodeFixProvider", "Add Yield" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator.CSharpChangeToIEnumerableCodeFixProvider", "Change To IEnumerable" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.HideBase.HideBaseCodeFixProvider+AddNewKeywordAction", "Hide Basen" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator.CSharpAddYieldCodeFixProvider", "Iterator: Add Yield" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator.CSharpChangeToIEnumerableCodeFixProvider", "Iterator: Change To IEnumerable" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.HideBase.HideBaseCodeFixProvider", "Hide Base" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.FixReturnType.CSharpFixReturnTypeCodeFixProvider", "Fix Return Type" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.ConditionalExpressionInStringInterpolation.CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider", "Add Parentheses Around Conditional Expression In String Interpolation" }, - { "Microsoft.CodeAnalysis.CSharp.AssignOutParameters.AbstractAssignOutParametersCodeFixProvider", "Assign Out Parameters" }, - { "Microsoft.CodeAnalysis.Wrapping.WrapItemsAction", "Wrap Items" }, - { "Microsoft.CodeAnalysis.UpgradeProject.ProjectOptionsChangeAction", "Upgrade Project" }, - { "Microsoft.CodeAnalysis.ExtractInterface.ExtractInterfaceCodeAction", "Extract Interface" }, - { "Microsoft.CodeAnalysis.ExtractClass.ExtractClassWithDialogCodeAction", "Extract Class With Dialog" }, - { "Microsoft.CodeAnalysis.CodeFixes.FixMultipleCodeAction", "Fix Multiple" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.TopLevelSuppressionCodeAction", "Top Level Suppression" }, - { "Microsoft.CodeAnalysis.ChangeSignature.ChangeSignatureCodeAction", "Change Signature" }, - { "Microsoft.CodeAnalysis.AddPackage.InstallPackageDirectlyCodeAction", "Install Package Directly" }, - { "Microsoft.CodeAnalysis.AddPackage.InstallPackageParentCodeAction", "Install Package Parent" }, - { "Microsoft.CodeAnalysis.AddPackage.InstallWithPackageManagerCodeAction", "Install With Package Manager" }, - { "Microsoft.CodeAnalysis.AddMissingReference.AddMissingReferenceCodeAction", "Add Missing Reference" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.AddInheritdoc.AddInheritdocCodeFixProvider", "Add Inheritdoc" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.AddExplicitCast.CSharpAddExplicitCastCodeFixProvider", "Add Explicit Cast" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.FullyQualify.CSharpFullyQualifyCodeFixProvider", "Fully Qualify" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.RemoveNewModifier.RemoveNewModifierCodeFixProvider", "Remove New Modifier" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.RemoveInKeyword.RemoveInKeywordCodeFixProvider", "Remove In Keyword" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.GenerateType.GenerateTypeCodeFixProvider", "Generate Type" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.GenerateDeconstructMethod.GenerateDeconstructMethodCodeFixProvider", "Generate Deconstruct Method" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.GenerateMethod.GenerateConversionCodeFixProvider", "Generate Method: Generate Conversion" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.GenerateMethod.GenerateMethodCodeFixProvider", "Generate Method" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.GenerateEnumMember.GenerateEnumMemberCodeFixProvider", "Generate Enum Member" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.ConvertToAsync.CSharpConvertToAsyncMethodCodeFixProvider", "Convert To Async: Method" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.ConditionalExpressionInStringInterpolation.CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider", "Conditional Expression In String Interpolation: Add Parentheses Around Conditional Expression In Interpolated String" }, + { "Microsoft.CodeAnalysis.CSharp.AssignOutParameters.AssignOutParametersAboveReturnCodeFixProvider", "Assign Out Parameters: Above Return" }, + { "Microsoft.CodeAnalysis.CSharp.AssignOutParameters.AssignOutParametersAtStartCodeFixProvider", "Assign Out Parameters: At Start" }, + { "Microsoft.CodeAnalysis.CSharp.AddParameter.CSharpAddParameterCodeFixProvider", "Add Parameter" }, + { "Microsoft.CodeAnalysis.CSharp.AddPackage.CSharpAddSpecificPackageCodeFixProvider", "Add Package: Add Specific Package" }, + { "Microsoft.CodeAnalysis.CSharp.AddMissingReference.CSharpAddMissingReferenceCodeFixProvider", "Add Missing Reference" }, + { "Microsoft.CodeAnalysis.CSharp.AddImport.CSharpAddImportCodeFixProvider", "Add Import" }, + { "Microsoft.CodeAnalysis.CSharp.AddFileBanner.CSharpAddFileBannerCodeRefactoringProvider", "Add File Banner (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.AddDebuggerDisplay.CSharpAddDebuggerDisplayCodeRefactoringProvider", "Add Debugger Display (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.AddAnonymousTypeMemberName.CSharpAddAnonymousTypeMemberNameCodeFixProvider", "Add Anonymous Type Member Name" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider+CustomCodeAction", "Enable Nullable (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.HideBase.HideBaseCodeFixProvider+AddNewKeywordAction", "Hide Base: Add New Keyword" }, + { "Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingCodeRefactoringProvider", "Rename Tracking (Refactoring)" }, + { "Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider+RenameTrackingCodeAction", "Rename Tracking" }, { "Microsoft.CodeAnalysis.UpdateLegacySuppressions.UpdateLegacySuppressionsCodeFixProvider", "Update Legacy Suppressions" }, { "Microsoft.CodeAnalysis.UseThrowExpression.UseThrowExpressionCodeFixProvider", "Use Throw Expression" }, - { "Microsoft.CodeAnalysis.UseSystemHashCode.UseSystemHashCodeCodeFixProvider", "Use System.HashCode" }, - { "Microsoft.CodeAnalysis.UseObjectInitializer.AbstractUseObjectInitializerCodeFixProvider`7", "Use Object Initializer" }, - { "Microsoft.CodeAnalysis.UseNullPropagation.AbstractUseNullPropagationCodeFixProvider`10", "Use Null Propagation" }, + { "Microsoft.CodeAnalysis.UseSystemHashCode.UseSystemHashCodeCodeFixProvider", "Use System Hash Code" }, { "Microsoft.CodeAnalysis.UseExplicitTupleName.UseExplicitTupleNameCodeFixProvider", "Use Explicit Tuple Name" }, - { "Microsoft.CodeAnalysis.UseIsNullCheck.AbstractUseIsNullCheckForReferenceEqualsCodeFixProvider`1", "Use 'Is Null' Check" }, - { "Microsoft.CodeAnalysis.UseInferredMemberName.AbstractUseInferredMemberNameCodeFixProvider", "Use Inferred Member Name" }, - { "Microsoft.CodeAnalysis.UseConditionalExpression.AbstractUseConditionalExpressionForAssignmentCodeFixProvider`6", "Use Conditional Expression For Assignment" }, - { "Microsoft.CodeAnalysis.UseConditionalExpression.AbstractUseConditionalExpressionForReturnCodeFixProvider`4", "Use Conditional Expression For Return" }, - { "Microsoft.CodeAnalysis.UseCompoundAssignment.AbstractUseCompoundAssignmentCodeFixProvider`3", "Use Compound Assignment" }, - { "Microsoft.CodeAnalysis.UseCollectionInitializer.AbstractUseCollectionInitializerCodeFixProvider`8", "Use Collection Initializer" }, { "Microsoft.CodeAnalysis.UseCoalesceExpression.UseCoalesceExpressionCodeFixProvider", "Use Coalesce Expression" }, - { "Microsoft.CodeAnalysis.UseCoalesceExpression.UseCoalesceExpressionForNullableCodeFixProvider", "Use Coalesce Expression For Nullable" }, - { "Microsoft.CodeAnalysis.SimplifyLinqExpression.AbstractSimplifyLinqExpressionCodeFixProvider`3", "Simplify Linq Expression" }, - { "Microsoft.CodeAnalysis.SimplifyInterpolation.AbstractSimplifyInterpolationCodeFixProvider`7", "Simplify Interpolation" }, - { "Microsoft.CodeAnalysis.SimplifyBooleanExpression.SimplifyConditionalCodeFixProvider", "Simplify Boolean Expression" }, - { "Microsoft.CodeAnalysis.RemoveUnusedParametersAndValues.AbstractRemoveUnusedValuesCodeFixProvider`11", "Remove Unused Parameters And Values" }, - { "Microsoft.CodeAnalysis.RemoveUnusedMembers.AbstractRemoveUnusedMembersCodeFixProvider`1", "Remove Unused Members" }, - { "Microsoft.CodeAnalysis.RemoveUnnecessaryImports.AbstractRemoveUnnecessaryImportsCodeFixProvider", "Remove Unnecessary Imports" }, - { "Microsoft.CodeAnalysis.QualifyMemberAccess.AbstractQualifyMemberAccessCodeFixprovider`2", "Qualify Member Access" }, - { "Microsoft.CodeAnalysis.PopulateSwitch.AbstractPopulateSwitchCodeFixProvider`4", "Populate Switch" }, - { "Microsoft.CodeAnalysis.OrderModifiers.AbstractOrderModifiersCodeFixProvider", "Order Modifiers" }, - { "Microsoft.CodeAnalysis.MakeFieldReadonly.AbstractMakeFieldReadonlyCodeFixProvider`2", "Make Field Readonly" }, - { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryInlineSuppressionsCodeFixProvider", "Remove Unnecessary Inline Suppressions" }, - { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryAttributeSuppressionsCodeFixProvider", "Remove Unnecessary Attribute Suppressions" }, + { "Microsoft.CodeAnalysis.UseCoalesceExpression.UseCoalesceExpressionForNullableCodeFixProvider", "Use Coalesce Expression: For Nullable" }, + { "Microsoft.CodeAnalysis.SimplifyBooleanExpression.SimplifyConditionalCodeFixProvider", "Simplify Boolean Expression: Simplify Conditional" }, + { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryInlineSuppressionsCodeFixProvider", "Remove Unnecessary Suppressions: Remove Unnecessary Inline Suppressions" }, + { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryAttributeSuppressionsCodeFixProvider", "Remove Unnecessary Suppressions: Remove Unnecessary Attribute Suppressions" }, { "Microsoft.CodeAnalysis.RemoveRedundantEquality.RemoveRedundantEqualityCodeFixProvider", "Remove Redundant Equality" }, - { "Microsoft.CodeAnalysis.NewLines.MultipleBlankLines.MultipleBlankLinesCodeFixProvider", "New Lines: Multiple Blank Lines" }, - { "Microsoft.CodeAnalysis.NewLines.ConsecutiveStatementPlacement.ConsecutiveStatementPlacementCodeFixProvider", "New Lines: Consecutive Statement Placement" }, - { "Microsoft.CodeAnalysis.FileHeaders.AbstractFileHeaderCodeFixProvider", "File Headers" }, - { "Microsoft.CodeAnalysis.ConvertTypeOfToNameOf.AbstractConvertTypeOfToNameOfCodeFixProvider", "Convert TypeOf To NameOf" }, - { "Microsoft.CodeAnalysis.ConvertAnonymousTypeToTuple.AbstractConvertAnonymousTypeToTupleCodeFixProvider`3", "Convert Anonymous Type To Tuple" }, + { "Microsoft.CodeAnalysis.NewLines.MultipleBlankLines.MultipleBlankLinesCodeFixProvider", "Multiple Blank Lines" }, + { "Microsoft.CodeAnalysis.NewLines.ConsecutiveStatementPlacement.ConsecutiveStatementPlacementCodeFixProvider", "Consecutive Statement Placement" }, { "Microsoft.CodeAnalysis.AddRequiredParentheses.AddRequiredParenthesesCodeFixProvider", "Add Required Parentheses" }, - { "Microsoft.CodeAnalysis.AddAccessibilityModifiers.AbstractAddAccessibilityModifiersCodeFixProvider", "Add Accessibility Modifiers" }, - { "Microsoft.CodeAnalysis.RemoveUnnecessaryParentheses.AbstractRemoveUnnecessaryParenthesesCodeFixProvider`1", "Remove Unnecessary Parentheses" }, - { "Microsoft.CodeAnalysis.UseNamedArguments.AbstractUseNamedArgumentsCodeRefactoringProvider", "Use Named Arguments" }, + { "Microsoft.CodeAnalysis.Wrapping.WrapItemsAction", "Wrapping: Wrap Items" }, + { "Microsoft.CodeAnalysis.UpgradeProject.ProjectOptionsChangeAction", "Upgrade Project: Project Options Change" }, + { "Microsoft.CodeAnalysis.ReplacePropertyWithMethods.ReplacePropertyWithMethodsCodeRefactoringProvider", "Replace Property With Methods (Refactoring)" }, + { "Microsoft.CodeAnalysis.ReplaceMethodWithProperty.ReplaceMethodWithPropertyCodeRefactoringProvider", "Replace Method With Property (Refactoring)" }, + { "Microsoft.CodeAnalysis.PreferFrameworkType.PreferFrameworkTypeCodeFixProvider", "Prefer Framework Type" }, + { "Microsoft.CodeAnalysis.MoveToNamespace.MoveToNamespaceCodeActionProvider", "Move To Namespace" }, + { "Microsoft.CodeAnalysis.MoveStaticMembers.MoveStaticMembersWithDialogCodeAction", "Move Static Members: With Dialog" }, + { "Microsoft.CodeAnalysis.IntroduceVariable.IntroduceVariableCodeRefactoringProvider", "Introduce Variable (Refactoring)" }, + { "Microsoft.CodeAnalysis.GenerateOverrides.GenerateOverridesCodeRefactoringProvider", "Generate Overrides (Refactoring)" }, + { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider", "Generate Equals And Get Hash Code From Members (Refactoring)" }, + { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.GenerateDefaultConstructorsCodeRefactoringProvider", "Generate Default Constructors (Refactoring)" }, + { "Microsoft.CodeAnalysis.GenerateComparisonOperators.GenerateComparisonOperatorsCodeRefactoringProvider", "Generate Comparison Operators (Refactoring)" }, + { "Microsoft.CodeAnalysis.ExtractInterface.ExtractInterfaceCodeAction", "Extract Interface" }, + { "Microsoft.CodeAnalysis.ExtractInterface.ExtractInterfaceCodeRefactoringProvider", "Extract Interface (Refactoring)" }, + { "Microsoft.CodeAnalysis.ExtractClass.ExtractClassWithDialogCodeAction", "Extract Class: With Dialog" }, + { "Microsoft.CodeAnalysis.EncapsulateField.EncapsulateFieldRefactoringProvider", "Encapsulate Field (Refactoring)" }, + { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.ConvertRegularStringToInterpolatedStringRefactoringProvider", "Convert To Interpolated String: Convert Regular String To Interpolated String (Refactoring)" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.FixAllCodeRefactoringCodeAction", "Code Refactorings: Fix All Code Refactoring" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.MoveType.MoveTypeCodeRefactoringProvider", "Move Type (Refactoring)" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.ExtractMethodCodeRefactoringProvider", "Extract Method (Refactoring)" }, + { "Microsoft.CodeAnalysis.CodeFixes.FixMultipleCodeAction", "Fix Multiple" }, + { "Microsoft.CodeAnalysis.CodeFixes.NamingStyles.NamingStyleCodeFixProvider", "Naming Styles: Naming Style" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.TopLevelSuppressionCodeAction", "Suppression: Top Level Suppression" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.WrapperCodeFixProvider", "Suppression: Wrapper" }, + { "Microsoft.CodeAnalysis.ChangeSignature.ChangeSignatureCodeRefactoringProvider", "Change Signature (Refactoring)" }, + { "Microsoft.CodeAnalysis.ChangeSignature.ChangeSignatureCodeAction", "Change Signature" }, + { "Microsoft.CodeAnalysis.AddPackage.InstallPackageDirectlyCodeAction", "Add Package: Install Package Directly" }, + { "Microsoft.CodeAnalysis.AddPackage.InstallPackageParentCodeAction", "Add Package: Install Package Parent" }, + { "Microsoft.CodeAnalysis.AddPackage.InstallWithPackageManagerCodeAction", "Add Package: Install With Package Manager" }, + { "Microsoft.CodeAnalysis.AddMissingReference.AddMissingReferenceCodeAction", "Add Missing Reference" }, + { "Microsoft.CodeAnalysis.AddConstructorParametersFromMembers.AddConstructorParametersFromMembersCodeRefactoringProvider", "Add Constructor Parameters From Members (Refactoring)" }, { "Microsoft.CodeAnalysis.UseAutoProperty.AbstractUseAutoPropertyCodeFixProvider`5+UseAutoPropertyCodeAction", "Use Auto Property" }, - { "Microsoft.CodeAnalysis.UnsealClass.AbstractUnsealClassCodeFixProvider", "Unseal Class" }, - { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractMergeConsecutiveIfStatementsCodeRefactoringProvider", "Merge Consecutive If Statements" }, - { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements" }, - { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements" }, - { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Into Nested If Statements" }, - { "Microsoft.CodeAnalysis.SpellCheck.AbstractSpellCheckCodeFixProvider`1+SpellCheckCodeAction", "Spell Check" }, - { "Microsoft.CodeAnalysis.SpellCheck.AbstractSpellCheckCodeFixProvider`1", "Spell Check" }, - { "Microsoft.CodeAnalysis.SimplifyTypeNames.AbstractSimplifyTypeNamesCodeFixProvider`1", "Simplify Type Names" }, - { "Microsoft.CodeAnalysis.SimplifyThisOrMe.AbstractSimplifyThisOrMeCodeFixProvider`1", "Simplify This Or Me" }, - { "Microsoft.CodeAnalysis.ReplacePropertyWithMethods.ReplacePropertyWithMethodsCodeRefactoringProvider+ReplacePropertyWithMethodsCodeAction", "Replace Property With Methods" }, - { "Microsoft.CodeAnalysis.ReplaceMethodWithProperty.ReplaceMethodWithPropertyCodeRefactoringProvider+ReplaceMethodWithPropertyCodeAction", "Replace Method With Property" }, - { "Microsoft.CodeAnalysis.ReplaceDocCommentTextWithTag.AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider", "Replace Doc Comment Text With Tag" }, - { "Microsoft.CodeAnalysis.RemoveUnusedVariable.AbstractRemoveUnusedVariableCodeFixProvider`3", "Remove Unused Variable" }, - { "Microsoft.CodeAnalysis.RemoveAsyncModifier.AbstractRemoveAsyncModifierCodeFixProvider`2", "Remove Async Modifier" }, - { "Microsoft.CodeAnalysis.PreferFrameworkType.PreferFrameworkTypeCodeFixProvider+PreferFrameworkTypeCodeAction", "Prefer Framework Type" }, - { "Microsoft.CodeAnalysis.NameTupleElement.AbstractNameTupleElementCodeRefactoringProvider`2", "Name Tuple Element" }, - { "Microsoft.CodeAnalysis.MoveToNamespace.AbstractMoveToNamespaceCodeAction+MoveItemsToNamespaceCodeAction", "Move Items To Namespace" }, - { "Microsoft.CodeAnalysis.MoveToNamespace.AbstractMoveToNamespaceCodeAction+MoveTypeToNamespaceCodeAction", "Move Type To Namespace" }, - { "Microsoft.CodeAnalysis.MoveDeclarationNearReference.AbstractMoveDeclarationNearReferenceCodeRefactoringProvider`1", "Move Declaration Near Reference" }, - { "Microsoft.CodeAnalysis.MakeMethodSynchronous.AbstractMakeMethodSynchronousCodeFixProvider", "Make Method Synchronous" }, - { "Microsoft.CodeAnalysis.MakeMethodAsynchronous.AbstractMakeMethodAsynchronousCodeFixProvider", "Make Method Asynchronous" }, - { "Microsoft.CodeAnalysis.MakeMemberStatic.AbstractMakeMemberStaticCodeFixProvider", "Make Member Static" }, - { "Microsoft.CodeAnalysis.MakeTypeAbstract.AbstractMakeTypeAbstractCodeFixProvider`1", "Make Type Abstract" }, - { "Microsoft.CodeAnalysis.InvertLogical.AbstractInvertLogicalCodeRefactoringProvider`3", "Invert Logical" }, - { "Microsoft.CodeAnalysis.InvertIf.AbstractInvertIfCodeRefactoringProvider`3", "Invert If" }, - { "Microsoft.CodeAnalysis.InvertConditional.AbstractInvertConditionalCodeRefactoringProvider`1", "Invert Conditional (Refactoring)" }, + { "Microsoft.CodeAnalysis.MoveToNamespace.AbstractMoveToNamespaceCodeAction+MoveItemsToNamespaceCodeAction", "Move To Namespace: Move Items To Namespace" }, + { "Microsoft.CodeAnalysis.MoveToNamespace.AbstractMoveToNamespaceCodeAction+MoveTypeToNamespaceCodeAction", "Move To Namespace: Move Type To Namespace" }, { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceVariableService`6+IntroduceVariableCodeAction", "Introduce Variable" }, - { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceVariableService`6+IntroduceVariableAllOccurrenceCodeAction", "Introduce Variable All Occurrence" }, - { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceLocalForExpressionCodeRefactoringProvider`4", "Introduce Variable For Expression" }, - { "Microsoft.CodeAnalysis.IntroduceUsingStatement.AbstractIntroduceUsingStatementCodeRefactoringProvider`2", "Introduce Using Statement" }, - { "Microsoft.CodeAnalysis.InlineMethod.AbstractInlineMethodRefactoringProvider`4+MySolutionChangeAction", "Inline Method (Refactoring)" }, - { "Microsoft.CodeAnalysis.InitializeParameter.AbstractInitializeParameterCodeRefactoringProvider`4", "Initialize Parameter" }, + { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceVariableService`6+IntroduceVariableAllOccurrenceCodeAction", "Introduce Variable: All Occurrence" }, { "Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction", "Implement Interface" }, - { "Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceWithDisposePatternCodeAction", "Implement Interface With Dispose Pattern" }, - { "Microsoft.CodeAnalysis.ImplementAbstractClass.AbstractImplementAbstractClassCodeFixProvider`1", "Implement Abstract Class" }, + { "Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceWithDisposePatternCodeAction", "Implement Interface: With Dispose Pattern" }, { "Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6+GenerateTypeCodeAction", "Generate Type" }, - { "Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6+GenerateTypeCodeActionWithOption", "Generate Type With Option" }, - { "Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6", "Generate Type" }, - { "Microsoft.CodeAnalysis.GenerateOverrides.GenerateOverridesCodeRefactoringProvider+GenerateOverridesWithDialogCodeAction", "Generate Overrides With Dialog" }, + { "Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6+GenerateTypeCodeActionWithOption", "Generate Type: With Option" }, + { "Microsoft.CodeAnalysis.GenerateOverrides.GenerateOverridesCodeRefactoringProvider+GenerateOverridesWithDialogCodeAction", "Generate Overrides: With Dialog (Refactoring)" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateVariableCodeAction", "Generate Variable" }, - { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3", "Generate Variable" }, - { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateLocalCodeAction", "Generate Local" }, - { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateParameterCodeAction", "Generate Parameter" }, + { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateLocalCodeAction", "Generate Variable: Generate Local" }, + { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateParameterCodeAction", "Generate Variable: Generate Parameter" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateParameterizedMember.AbstractGenerateParameterizedMemberService`4+GenerateParameterizedMemberCodeAction", "Generate Parameterized Member" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateEnumMember.AbstractGenerateEnumMemberService`3+GenerateEnumMemberCodeAction", "Generate Enum Member" }, - { "Microsoft.CodeAnalysis.GenerateMember.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+GenerateDefaultConstructorCodeAction", "Generate Default Constructors" }, - { "Microsoft.CodeAnalysis.GenerateMember.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+CodeActionAll", "Generate Default Constructors All" }, - { "Microsoft.CodeAnalysis.GenerateMember.GenerateConstructor.AbstractGenerateConstructorService`2", "Generate Constructor" }, - { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeAction", "Generate Equals And Get Hash Code From Members" }, - { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeWithDialogCodeAction", "Generate Equals And Get Hash Code From Members With Dialog" }, - { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+ConstructorDelegatingCodeAction", "Generate Constructor From Members (Constructor Delegating)" }, - { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+FieldDelegatingCodeAction", "Generate Constructor From Members (Field Delegating)" }, - { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+GenerateConstructorWithDialogCodeAction", "Generate Constructor From Members With Dialog" }, - { "Microsoft.CodeAnalysis.GenerateComparisonOperators.GenerateComparisonOperatorsCodeRefactoringProvider", "Generate Comparison Operators" }, - { "Microsoft.CodeAnalysis.Formatting.FormattingCodeFixProvider", "Fix Formatting" }, - { "Microsoft.CodeAnalysis.EncapsulateField.AbstractEncapsulateFieldService", "Encapsulate Field" }, - { "Microsoft.CodeAnalysis.DiagnosticComments.CodeFixes.AbstractAddDocCommentNodesCodeFixProvider`4", "Diagnostic Comments: Add DocComment Nodes" }, - { "Microsoft.CodeAnalysis.DiagnosticComments.CodeFixes.AbstractRemoveDocCommentNodeCodeFixProvider`2", "Diagnostic Comments: Remove DocComment Node" }, - { "Microsoft.CodeAnalysis.ConvertTupleToStruct.AbstractConvertTupleToStructCodeRefactoringProvider`10", "Convert Tuple To Struct" }, - { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertConcatenationToInterpolatedStringRefactoringProvider`1", "Convert Concatenation To Interpolated String" }, - { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider`5+ConvertToInterpolatedStringCodeAction", "Convert Placeholder To Interpolated String" }, - { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.ConvertRegularStringToInterpolatedStringRefactoringProvider", "Convert Regular String To Interpolated String" }, - { "Microsoft.CodeAnalysis.ConvertNumericLiteral.AbstractConvertNumericLiteralCodeRefactoringProvider`1", "Convert Numeric Literal" }, - { "Microsoft.CodeAnalysis.ConvertLinq.AbstractConvertLinqQueryToForEachProvider`2", "Convert Linq Query To ForEach" }, - { "Microsoft.CodeAnalysis.ConvertLinq.ConvertForEachToLinqQuery.AbstractConvertForEachToLinqQueryProvider`2+ForEachToLinqQueryCodeAction", "Convert ForEach To Linq Query" }, - { "Microsoft.CodeAnalysis.ConvertIfToSwitch.AbstractConvertIfToSwitchCodeRefactoringProvider`4", "Convert If To Switch" }, - { "Microsoft.CodeAnalysis.ConvertForToForEach.AbstractConvertForToForEachCodeRefactoringProvider`6", "Convert For To ForEach" }, - { "Microsoft.CodeAnalysis.ConvertForEachToFor.AbstractConvertForEachToForCodeRefactoringProvider`2+ForEachToForCodeAction", "Convert ForEach To For" }, - { "Microsoft.CodeAnalysis.ConvertCast.AbstractConvertCastCodeRefactoringProvider`3", "Convert Cast" }, - { "Microsoft.CodeAnalysis.ConvertAutoPropertyToFullProperty.AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider`3+ConvertAutoPropertyToFullPropertyCodeAction", "Convert AutoProperty To Full Property" }, - { "Microsoft.CodeAnalysis.ConflictMarkerResolution.AbstractResolveConflictMarkerCodeFixProvider", "Resolve Conflict Marker" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousTypeToClass.AbstractConvertAnonymousTypeToClassCodeRefactoringProvider`6", "Convert Anonymous Type To Class" }, - { "Microsoft.CodeAnalysis.AddMissingImports.AbstractAddMissingImportsRefactoringProvider+AddMissingImportsCodeAction", "Add Missing Imports (Paste)" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.PullMemberUp.AbstractPullMemberUpRefactoringProvider+PullMemberUpWithDialogCodeAction", "Pull Member Up" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.SyncNamespace.AbstractSyncNamespaceCodeRefactoringProvider`3+ChangeNamespaceCodeAction", "Sync Namespace: Change Namespace" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.SyncNamespace.AbstractSyncNamespaceCodeRefactoringProvider`3+MoveFileCodeAction", "Sync Namespace: Move File" }, + { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeAction", "Generate Equals And Get Hash Code From Members: Generate Equals And Get Hash (Refactoring)" }, + { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeWithDialogCodeAction", "Generate Equals And Get Hash Code From Members: Generate Equals And Get Hash Code With Dialog (Refactoring)" }, + { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+GenerateDefaultConstructorCodeAction", "Generate Default Constructors: Generate Default Constructor" }, + { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+CodeActionAll", "Generate Default Constructors: Code Action All" }, + { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+ConstructorDelegatingCodeAction", "Generate Constructor From Members: Constructor Delegating (Refactoring)" }, + { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+FieldDelegatingCodeAction", "Generate Constructor From Members: Field Delegating (Refactoring)" }, + { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+GenerateConstructorWithDialogCodeAction", "Generate Constructor From Members: Generate Constructor With Dialog (Refactoring)" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.PullMemberUp.AbstractPullMemberUpRefactoringProvider+PullMemberUpWithDialogCodeAction", "Pull Member Up: With Dialog (Refactoring)" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.SyncNamespace.AbstractSyncNamespaceCodeRefactoringProvider`3+MoveFileCodeAction", "Sync Namespace: Move File (Refactoring)" }, { "Microsoft.CodeAnalysis.CodeRefactorings.MoveType.AbstractMoveTypeService`5+MoveTypeCodeAction", "Move Type" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.ExtractMethodCodeRefactoringProvider", "Extract Method" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.AddAwait.AbstractAddAwaitCodeRefactoringProvider`1", "Add Await" }, - { "Microsoft.CodeAnalysis.CodeFixes.NamingStyles.NamingStyleCodeFixProvider+FixNameCodeAction", "Fix Naming Style" }, - { "Microsoft.CodeAnalysis.CodeFixes.MatchFolderAndNamespace.AbstractChangeNamespaceToMatchFolderCodeFixProvider", "Change Namespace To Match Folder" }, - { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider", "Fully Qualify" }, - { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider+GroupingCodeAction", "Fully Qualify (Grouping)" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageCodeAction", "Suppression.: Global Suppress Message" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction", "Suppression: Global Suppress Message (FixAll)" }, + { "Microsoft.CodeAnalysis.CodeFixes.NamingStyles.NamingStyleCodeFixProvider+FixNameCodeAction", "Naming Style: Fix Name" }, + { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider+GroupingCodeAction", "Fully Qualify: Grouping" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageCodeAction", "Suppression: Global Suppress Message" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction", "Suppression: Global Suppress Message Fix All" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+LocalSuppressMessageCodeAction", "Suppression: Local Suppress Message" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+PragmaWarningCodeAction", "Suppression: Pragma Warning" }, - { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelBulkConfigureSeverityCodeAction", "Configure Severity: TopLevel Bulk Configure Severity" }, - { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelConfigureSeverityCodeAction", "Configure Severity: TopLevel Configure Severity" }, - { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureCodeStyle.ConfigureCodeStyleOptionCodeFixProvider+TopLevelConfigureCodeStyleOptionCodeAction", "Configure CodeStyle Option: TopLevel Configure CodeStyle Option" }, - { "Microsoft.CodeAnalysis.CodeFixes.Async.AbstractConvertToAsyncCodeFixProvider", "Convert To Async" }, - { "Microsoft.CodeAnalysis.CodeFixes.AddExplicitCast.AbstractAddExplicitCastCodeFixProvider`1", "Add Explicit Cast" }, - { "Microsoft.CodeAnalysis.AliasAmbiguousType.AbstractAliasAmbiguousTypeCodeFixProvider", "Alias Ambiguous Type" }, - { "Microsoft.CodeAnalysis.AddParameter.AbstractAddParameterCodeFixProvider`6", "Add Parameter" }, - { "Microsoft.CodeAnalysis.AddObsoleteAttribute.AbstractAddObsoleteAttributeCodeFixProvider", "Add Obsolete Attribute" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+AssemblyReferenceCodeAction", "AddImport (Assembly Reference)" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallPackageAndAddImportCodeAction", "AddImport (Install Package And Add Import)" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallWithPackageManagerCodeAction", "AddImport (Install With PackageManager)" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+MetadataSymbolReferenceCodeAction", "AddImport (Metadata Symbol Reference)" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ParentInstallPackageCodeAction", "Add Import (Install Nuget Package)" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ProjectSymbolReferenceCodeAction", "Add Import (Project Symbol Reference)" }, - { "Microsoft.CodeAnalysis.AddFileBanner.AbstractAddFileBannerCodeRefactoringProvider", "Add File Banner" }, - { "Microsoft.CodeAnalysis.AddDebuggerDisplay.AbstractAddDebuggerDisplayCodeRefactoringProvider`2", "Add Debugger Display" }, - { "Microsoft.CodeAnalysis.AddConstructorParametersFromMembers.AddConstructorParametersFromMembersCodeRefactoringProvider+AddConstructorParametersCodeAction", "Add Constructor Parameters From Members" }, - { "Microsoft.CodeAnalysis.AddAnonymousTypeMemberName.AbstractAddAnonymousTypeMemberNameCodeFixProvider`3", "Add Anonymous Type Member Name" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction+GlobalSuppressionSolutionChangeAction", "Suppression: Global Suppress Message (FixAll)" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+AttributeRemoveAction", "Suppression: Remove Suppression (Attribute)" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+PragmaRemoveAction", "Suppression: Remove Suppression (Pragma)" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeActions.RemoveStatementCodeAction", "Remove Statement" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.CorrectNextControlVariable.CorrectNextControlVariableCodeFixProvider+CorrectNextControlVariableCodeAction", "Correct Next Control Variable" }, + { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelBulkConfigureSeverityCodeAction", "Configure Severity Level: Top Level Bulk Configure Severity" }, + { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelConfigureSeverityCodeAction", "Configure Severity Level: Top Level Configure Severity" }, + { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureCodeStyle.ConfigureCodeStyleOptionCodeFixProvider+TopLevelConfigureCodeStyleOptionCodeAction", "Configure Code Style Option: Top Level Configure Code Style Option" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+AssemblyReferenceCodeAction", "Add Import: Assembly Reference" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallPackageAndAddImportCodeAction", "Add Import: Install Package And Add Import" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallWithPackageManagerCodeAction", "Add Import: Install With Package Manager" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+MetadataSymbolReferenceCodeAction", "Add Import: Metadata Symbol Reference" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ParentInstallPackageCodeAction", "Add Import: Parent Install Package" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ProjectSymbolReferenceCodeAction", "Add Import: Project Symbol Reference" }, + { "Microsoft.CodeAnalysis.AddConstructorParametersFromMembers.AddConstructorParametersFromMembersCodeRefactoringProvider+AddConstructorParametersCodeAction", "Add Constructor Parameters From Members: Add Constructor Parameters (Refactoring)" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction+GlobalSuppressionSolutionChangeAction", "Global Suppress Message Fix All: Global Suppression Solution Change" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+AttributeRemoveAction", "Remove Suppression: Attribute Remove" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+PragmaRemoveAction", "Remove Suppression: Pragma Remove" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddAnonymousTypeMemberName.VisualBasicAddAnonymousTypeMemberNameCodeFixProvider", "Add Anonymous Type Member Name" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddDebuggerDisplay.VisualBasicAddDebuggerDisplayCodeRefactoringProvider", "Add Debugger Display (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddFileBanner.VisualBasicAddFileBannerCodeRefactoringProvider", "Add File Banner (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddImport.VisualBasicAddImportCodeFixProvider", "Add Import" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddPackage.VisualBasicAddSpecificPackageCodeFixProvider", "Add Package: Add Specific Package" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddParameter.VisualBasicAddParameterCodeFixProvider", "Add Parameter" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddMissingReference.VisualBasicAddMissingReferenceCodeFixProvider", "Add Missing Reference" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.ConvertToAsync.VisualBasicConvertToAsyncFunctionCodeFixProvider", "Convert To Async: Function" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.CorrectNextControlVariable.CorrectNextControlVariableCodeFixProvider", "Correct Next Control Variable" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEndConstruct.GenerateEndConstructCodeFixProvider", "Generate End Construct" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEnumMember.GenerateEnumMemberCodeFixProvider", "Generate Enum Member" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEvent.GenerateEventCodeFixProvider", "Generate Event" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateMethod.GenerateConversionCodeFixProvider", "Generate Method: Generate Conversion" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateMethod.GenerateParameterizedMemberCodeFixProvider", "Generate Method: Generate Parameterized Member" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateType.GenerateTypeCodeFixProvider", "Generate Type" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider", "Incorrect Exit Continue" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectFunctionReturnType.IncorrectFunctionReturnTypeCodeFixProvider", "Incorrect Function Return Type" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.MoveToTopOfFile.MoveToTopOfFileCodeFixProvider", "Move To Top Of File" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.OverloadBase.OverloadBaseCodeFixProvider", "Overload Base" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.FullyQualify.VisualBasicFullyQualifyCodeFixProvider", "Fully Qualify" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.AddExplicitCast.VisualBasicAddExplicitCastCodeFixProvider", "Add Explicit Cast" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicChangeToYieldCodeFixProvider", "Iterator: Change To Yield" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicConvertToIteratorCodeFixProvider", "Iterator: Convert To Iterator" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.AddAwait.VisualBasicAddAwaitCodeRefactoringProvider", "Add Await (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineMethodRefactoringProvider", "Inline Temporary: Inline Method (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineTemporaryCodeRefactoringProvider", "Inline Temporary (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.MoveStaticMembers.VisualBasicMoveStaticMembersRefactoringProvider", "Move Static Members (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeActions.RemoveStatementCodeAction", "Code Actions: Remove Statement" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConflictMarkerResolution.VisualBasicResolveConflictMarkerCodeFixProvider", "Conflict Marker Resolution: Resolve Conflict Marker" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertAnonymousType.VisualBasicConvertAnonymousTypeToClassCodeRefactoringProvider", "Convert Anonymous Type: To Class (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertAnonymousTypeToTuple.VisualBasicConvertAnonymousTypeToTupleCodeRefactoringProvider", "Convert Anonymous Type To Tuple (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertAutoPropertyToFullProperty.VisualBasicConvertAutoPropertyToFullPropertyCodeRefactoringProvider", "Convert Auto Property To Full Property (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertCast.VisualBasicConvertDirectCastToTryCastCodeRefactoringProvider", "Convert Cast: Convert Direct Cast To Try Cast (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertConversionOperators.VisualBasicConvertTryCastToDirectCastCodeRefactoringProvider", "Convert Conversion Operators: Convert Try Cast To Direct Cast (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertForEachToFor.VisualBasicConvertForEachToForCodeRefactoringProvider", "Convert For Each To For (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertForToForEach.VisualBasicConvertForToForEachCodeRefactoringProvider", "Convert For To For Each (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertIfToSwitch.VisualBasicConvertIfToSwitchCodeRefactoringProvider", "Convert If To Switch (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertNumericLiteral.VisualBasicConvertNumericLiteralCodeRefactoringProvider", "Convert Numeric Literal (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString.VisualBasicConvertConcatenationToInterpolatedStringRefactoringProvider", "Convert To Interpolated String: Convert Concatenation To Interpolated String (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString.VisualBasicConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert To Interpolated String: Convert Placeholder To Interpolated String (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertTupleToStruct.VisualBasicConvertTupleToStructCodeRefactoringProvider", "Convert Tuple To Struct (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.Features.EmbeddedLanguages.VisualBasicJsonDetectionCodeFixProvider", "Embedded Languages: Json Detection" }, + { "Microsoft.CodeAnalysis.VisualBasic.GenerateConstructorFromMembers.VisualBasicGenerateConstructorFromMembersCodeRefactoringProvider", "Generate Constructor From Members (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.GenerateConstructor.GenerateConstructorCodeFixProvider", "Generate Constructor" }, + { "Microsoft.CodeAnalysis.VisualBasic.GenerateDefaultConstructors.VisualBasicGenerateDefaultConstructorsCodeFixProvider", "Generate Default Constructors" }, + { "Microsoft.CodeAnalysis.VisualBasic.GenerateVariable.VisualBasicGenerateVariableCodeFixProvider", "Generate Variable" }, + { "Microsoft.CodeAnalysis.VisualBasic.ImplementAbstractClass.VisualBasicImplementAbstractClassCodeFixProvider", "Implement Abstract Class" }, + { "Microsoft.CodeAnalysis.VisualBasic.ImplementInterface.VisualBasicImplementInterfaceCodeFixProvider", "Implement Interface" }, + { "Microsoft.CodeAnalysis.VisualBasic.InitializeParameter.VisualBasicAddParameterCheckCodeRefactoringProvider", "Initialize Parameter: Add Parameter Check (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.InitializeParameter.VisualBasicInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Parameter: Initialize Member From Parameter (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.IntroduceUsingStatement.VisualBasicIntroduceUsingStatementCodeRefactoringProvider", "Introduce Using Statement (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable.VisualBasicIntroduceLocalForExpressionCodeRefactoringProvider", "Introduce Variable: Introduce Local For Expression (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable.VisualBasicIntroduceParameterCodeRefactoringProvider", "Introduce Variable: Introduce Parameter (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertConditional.VisualBasicInvertConditionalCodeRefactoringProvider", "Invert Conditional (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertIf.VisualBasicInvertMultiLineIfCodeRefactoringProvider", "Invert If: Invert Multi Line If (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertIf.VisualBasicInvertSingleLineIfCodeRefactoringProvider", "Invert If: Invert Single Line If (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertLogical.VisualBasicInvertLogicalCodeRefactoringProvider", "Invert Logical (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.MakeMethodAsynchronous.VisualBasicMakeMethodAsynchronousCodeFixProvider", "Make Method Asynchronous" }, + { "Microsoft.CodeAnalysis.VisualBasic.MakeMethodSynchronous.VisualBasicMakeMethodSynchronousCodeFixProvider", "Make Method Synchronous" }, + { "Microsoft.CodeAnalysis.VisualBasic.MoveDeclarationNearReference.VisualBasicMoveDeclarationNearReferenceCodeRefactoringProvider", "Move Declaration Near Reference (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.NameTupleElement.VisualBasicNameTupleElementCodeRefactoringProvider", "Name Tuple Element (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveAsyncModifier.VisualBasicRemoveAsyncModifierCodeFixProvider", "Remove Async Modifier" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveSharedFromModuleMembers.VisualBasicRemoveSharedFromModuleMembersCodeFixProvider", "Remove Shared From Module Members" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnusedVariable.VisualBasicRemoveUnusedVariableCodeFixProvider", "Remove Unused Variable" }, + { "Microsoft.CodeAnalysis.VisualBasic.ReplaceConditionalWithStatements.VisualBasicReplaceConditionalWithStatementsCodeRefactoringProvider", "Replace Conditional With Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ReplaceDocCommentTextWithTag.VisualBasicReplaceDocCommentTextWithTagCodeRefactoringProvider", "Replace Doc Comment Text With Tag (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.SimplifyThisOrMe.VisualBasicSimplifyThisOrMeCodeFixProvider", "Simplify This Or Me" }, + { "Microsoft.CodeAnalysis.VisualBasic.SimplifyTypeNames.SimplifyTypeNamesCodeFixProvider", "Simplify Type Names" }, + { "Microsoft.CodeAnalysis.VisualBasic.SpellCheck.VisualBasicSpellCheckCodeFixProvider", "Spell Check" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicMergeConsecutiveIfStatementsCodeRefactoringProvider", "Split Or Merge If Statements: Merge Consecutive If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicMergeNestedIfStatementsCodeRefactoringProvider", "Split Or Merge If Statements: Merge Nested If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Or Merge If Statements: Split Into Consecutive If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Or Merge If Statements: Split Into Nested If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseAutoProperty.VisualBasicUseAutoPropertyCodeFixProvider", "Use Auto Property" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseNamedArguments.VisualBasicUseNamedArgumentsCodeRefactoringProvider", "Use Named Arguments (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.Wrapping.VisualBasicWrappingCodeRefactoringProvider", "Wrapping (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddAccessibilityModifiers.VisualBasicAddAccessibilityModifiersCodeFixProvider", "Add Accessibility Modifiers" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertTypeOfToNameOf.VisualBasicConvertGetTypeToNameOfCodeFixProvider", "Convert Type Of To Name Of: Convert Get Type To Name Of" }, + { "Microsoft.CodeAnalysis.VisualBasic.FileHeaders.VisualBasicFileHeaderCodeFixProvider", "File Headers: File Header" }, + { "Microsoft.CodeAnalysis.VisualBasic.OrderModifiers.VisualBasicOrderModifiersCodeFixProvider", "Order Modifiers" }, + { "Microsoft.CodeAnalysis.VisualBasic.PopulateSwitch.VisualBasicPopulateSwitchStatementCodeFixProvider", "Populate Switch: Statement" }, + { "Microsoft.CodeAnalysis.VisualBasic.QualifyMemberAccess.VisualBasicQualifyMemberAccessCodeFixProvider", "Qualify Member Access" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryByVal.VisualBasicRemoveUnnecessaryByValCodeFixProvider", "Remove Unnecessary By Val" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryCast.VisualBasicRemoveUnnecessaryCastCodeFixProvider", "Remove Unnecessary Cast" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryImports.VisualBasicRemoveUnnecessaryImportsCodeFixProvider", "Remove Unnecessary Imports" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryParentheses.VisualBasicRemoveUnnecessaryParenthesesCodeFixProvider", "Remove Unnecessary Parentheses" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnusedMembers.VisualBasicRemoveUnusedMembersCodeFixProvider", "Remove Unused Members" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnusedParametersAndValues.VisualBasicRemoveUnusedValuesCodeFixProvider", "Remove Unused Parameters And Values: Remove Unused Values" }, + { "Microsoft.CodeAnalysis.VisualBasic.SimplifyInterpolation.VisualBasicSimplifyInterpolationCodeFixProvider", "Simplify Interpolation" }, + { "Microsoft.CodeAnalysis.VisualBasic.SimplifyLinqExpression.VisualBasicSimplifyLinqExpressionCodeFixProvider", "Simplify Linq Expression" }, + { "Microsoft.CodeAnalysis.VisualBasic.SimplifyObjectCreation.VisualBasicSimplifyObjectCreationCodeFixProvider", "Simplify Object Creation" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseCollectionInitializer.VisualBasicUseCollectionInitializerCodeFixProvider", "Use Collection Initializer" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseCompoundAssignment.VisualBasicUseCompoundAssignmentCodeFixProvider", "Use Compound Assignment" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseConditionalExpression.VisualBasicUseConditionalExpressionForAssignmentCodeFixProvider", "Use Conditional Expression: For Assignment" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseConditionalExpression.VisualBasicUseConditionalExpressionForReturnCodeFixProvider", "Use Conditional Expression: For Return" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseInferredMemberName.VisualBasicUseInferredMemberNameCodeFixProvider", "Use Inferred Member Name" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseIsNotExpression.VisualBasicUseIsNotExpressionCodeFixProvider", "Use Is Not Expression" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseIsNullCheck.VisualBasicUseIsNullCheckForReferenceEqualsCodeFixProvider", "Use Is Null Check: For Reference Equals" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseNullPropagation.VisualBasicUseNullPropagationCodeFixProvider", "Use Null Propagation" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseObjectInitializer.VisualBasicUseObjectInitializerCodeFixProvider", "Use Object Initializer" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddObsoleteAttribute.VisualBasicAddObsoleteAttributeCodeFixProvider", "Add Obsolete Attribute" }, + { "Microsoft.CodeAnalysis.VisualBasic.AliasAmbiguousType.VisualBasicAliasAmbiguousTypeCodeFixProvider", "Alias Ambiguous Type" }, + { "Microsoft.CodeAnalysis.VisualBasic.MakeFieldReadonly.VisualBasicMakeFieldReadonlyCodeFixProvider", "Make Field Readonly" }, + { "Microsoft.CodeAnalysis.VisualBasic.MakeTypeAbstract.VisualBasicMakeTypeAbstractCodeFixProvider", "Make Type Abstract" }, + { "Microsoft.CodeAnalysis.VisualBasic.UnsealClass.VisualBasicUnsealClassCodeFixProvider", "Unseal Class" }, + { "Microsoft.CodeAnalysis.DiagnosticComments.CodeFixes.VisualBasicRemoveDocCommentNodeCodeFixProvider", "Remove Doc Comment Node" }, + { "Microsoft.CodeAnalysis.CodeStyle.VisualBasicFormattingCodeFixProvider", "Formatting" }, + { "VisualBasicAddMissingImportsRefactoringProvider", "Add Missing Imports (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.CorrectNextControlVariable.CorrectNextControlVariableCodeFixProvider+CorrectNextControlVariableCodeAction", "Correct Next Control Variable" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEvent.GenerateEventCodeFixProvider+GenerateEventCodeAction", "Generate Event" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+AddKeywordCodeAction", "Incorrect Exit Continue: Add Keyword" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+ReplaceKeywordCodeAction", "Incorrect Exit Continue: Replace Keyword" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+ReplaceTokenKeywordCodeAction", "Incorrect Exit Continue: Replace Token Keyword" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectFunctionReturnType.IncorrectFunctionReturnTypeCodeFixProvider", "Incorrect Function Return Type" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicChangeToYieldCodeFixProvider", "Change To Yield" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicConvertToIteratorCodeFixProvider", "Convert To Iterator" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.MoveToTopOfFile.MoveToTopOfFileCodeFixProvider+MoveToLineCodeAction", "Move To Top Of File" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.MoveToTopOfFile.MoveToTopOfFileCodeFixProvider+MoveToLineCodeAction", "Move To Top Of File: Move To Line" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.OverloadBase.OverloadBaseCodeFixProvider+AddKeywordAction", "Overload Base: Add Keyword" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineTemporaryCodeRefactoringProvider", "Inline Temporary" }, - { "Microsoft.CodeAnalysis.VisualBasic.RemoveSharedFromModuleMembers.VisualBasicRemoveSharedFromModuleMembersCodeFixProvider", "Remove Shared From Module Members" }, - { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryByVal.VisualBasicRemoveUnnecessaryByValCodeFixProvider", "Remove Unnecessary ByVal" }, - { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryCast.VisualBasicRemoveUnnecessaryCastCodeFixProvider", "Remove Unnecessary Cast" }, - { "Microsoft.CodeAnalysis.VisualBasic.UseIsNotExpression.VisualBasicUseIsNotExpressionCodeFixProvider", "Use IsNot Expression" }, - { "Microsoft.CodeAnalysis.CSharp.UseTupleSwap.CSharpUseTupleSwapCodeFixProvider", "Use Tuple Swap" }, - { "Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseNullCheckOverTypeCheckCodeFixProvider", "Use Null Check Over Type Check" }, - { "Microsoft.CodeAnalysis.CSharp.SimplifyPropertyPattern.CSharpSimplifyPropertyPatternCodeFixProvider", "Simplify Property Pattern" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeRefactoringProvider", "Convert Namespace Refactoring (FileScope/BlockScope)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeFixProvider", "Convert Namespace CodeFix (FileScope/BlockScope)" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseRecursivePatterns.UseRecursivePatternsCodeRefactoringProvider", "Use Recursive Patterns" }, - { "Microsoft.CodeAnalysis.MoveStaticMembers.MoveStaticMembersWithDialogCodeAction", "Move Static Members" }, - { "Microsoft.CodeAnalysis.SimplifyInterpolation.AbstractSimplifyInterpolationCodeFixProvider`5", "Simplify Interpolation" }, - { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceParameterService`4", "Introduce Parameter" }, - { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+GenerateDefaultConstructorCodeAction", "Generate Default Constructor" }, - { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+CodeActionAll", "Generate Default Constructur (All)" }, - { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider`6+ConvertToInterpolatedStringCodeAction", "Convert Placeholder To Interpolated String" }, - { "Microsoft.CodeAnalysis.ConvertAnonymousType.AbstractConvertAnonymousTypeToClassCodeRefactoringProvider`6", "Convert Anonymous Type To Class" }, - { "Microsoft.CodeAnalysis.ConvertAnonymousType.AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider`3", "Convert Anonymous Type To Tuple" }, - { "Microsoft.CodeAnalysis.VisualBasic.SimplifyObjectCreation.VisualBasicSimplifyObjectCreationCodeFixProvider", "Simplify Object Creation" }, - { "Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider+RenameTrackingCodeAction", "Rename Tracking" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.AddInheritdoc.AddInheritdocCodeFixProvider", "Add Inheritdoc" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.TransposeRecordKeyword.CSharpTransposeRecordKeywordCodeFixProvider", "Fix record declaration" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertToRawString.ConvertRegularStringToRawStringCodeRefactoringProvider", "Convert to raw string" }, - { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryLambdaExpression.CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider", "Remove Unnecessary Lambda Expression" }, - { "Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageServices.AbstractJsonDetectionCodeFixProvider", "Enable all JSON editor features" }, + { "Microsoft.CodeAnalysis.CodeFixesAndRefactorings.DocumentBasedFixAllProviderHelpers+PostProcessCodeAction", "Document Based Fix All: Post Process" }, }.ToImmutableDictionary(); public static void Main(string[] args) @@ -300,9 +440,9 @@ public static void Main(string[] args) Console.WriteLine($"Generating Kusto datatable of {codeActionAndProviderTypes.Length} CodeAction and provider hashes ..."); var telemetryInfos = GetTelemetryInfos(codeActionAndProviderTypes); - var datatable = GenerateKustoDatatable(telemetryInfos); + var datatable = GenerateKustoDatatable(telemetryInfos); // GenerateCodeActionsDescriptionMap(telemetryInfos); - var filepath = Path.GetFullPath(".\\ActionTable.txt"); + var filepath = Path.GetFullPath("ActionTable.txt"); Console.WriteLine($"Writing datatable to {filepath} ..."); @@ -405,6 +545,145 @@ internal static string GenerateKustoDatatable(ImmutableArray tele return table.ToString(); } + // NOTE: This method is unused but still present in case we want to auto-generate and refresh the "CodeActionsDescriptionMap". + internal static string GenerateCodeActionsDescriptionMap(ImmutableArray telemetryInfos) + { + var builder = new StringBuilder(); + + builder.AppendLine("{"); + + // Regex to split where letter capitalization changes. Try not to split up interface names such as IEnumerable. + var regex = new Regex(@" + (?<=[I])(?=[A-Z]) & + (?<=[A-Z])(?=[A-Z][a-z]) | + (?<=[^A-Z])(?=[A-Z]) | + (?<=[A-Za-z])(?=[^A-Za-z])", RegexOptions.IgnorePatternWhitespace); + + // Prefixes and suffixes to trim out. + var prefixStrings = new[] + { + "Abstract", + "CSharp", + "VisualBasic", + "CodeFixes", + "CodeStyle", + "TypeStyle", + }; + + var suffixStrings = new[] + { + "CodeFixProvider", + "CodeRefactoringProvider", + "RefactoringProvider", + "TaggerProvider", + "CustomCodeAction", + "CodeAction", + "CodeActionWithOption", + "CodeActionProvider", + "Action", + "FeatureService", + "Service", + "ProviderHelpers", + "Provider", + }; + + foreach (var (actionOrProviderTypeName, _) in telemetryInfos) + { + if (IgnoredCodeActions.Contains(actionOrProviderTypeName)) + { + continue; + } + + // We create the description string from the namespace and type name after omitting the well-known prefixes and suffixes. + var descriptionParts = actionOrProviderTypeName.Replace('.', '+').Split('+'); + + // When there is deep nesting, construct the descriptions from the inner two names. + var startIndex = Math.Max(0, descriptionParts.Length - 2); + + var description = string.Empty; + var isRefactoring = false; + + for (int index = startIndex; index < descriptionParts.Length; index++) + { + var part = descriptionParts[index]; + + // Remove TypeParameter count + if (part.Contains('`')) + { + part = part.Split('`')[0]; + } + + foreach (var prefix in prefixStrings) + { + if (part.StartsWith(prefix)) + { + part = part.Substring(prefix.Length); + break; + } + } + + foreach (var suffix in suffixStrings) + { + if (part.EndsWith(suffix)) + { + part = part.Substring(0, part.LastIndexOf(suffix)); + + if (suffix == "CodeActionWithOption") + { + part += "WithOption"; + } + else if (suffix == "CodeRefactoringProvider" || suffix == "RefactoringProvider") + { + isRefactoring = true; + } + + break; + } + } + + if (part.Length == 0) + { + continue; + } + + // Split type name into words + part = regex.Replace(part, " "); + + if (description.Length == 0) + { + description = part; + continue; + } + + if (description == part) + { + // Don't repeat the containing type name. + continue; + } + + if (part.StartsWith(description)) + { + // Don't repeat the containing type name. + part = part.Substring(description.Length).TrimStart(); + } + + description = $"{description}: {part}"; + } + + if (isRefactoring) + { + // Ensure we differentiate refactorings from similar named fixes. + description += " (Refactoring)"; + } + + builder.AppendLine(@$" {{ ""{actionOrProviderTypeName}"", ""{description}"" }},"); + } + + builder.Append("}"); + + return builder.ToString(); + } + private class FullNameTypeComparer : IEqualityComparer { public static FullNameTypeComparer Instance { get; } = new FullNameTypeComparer(); diff --git a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs index f88985d0856bd..099b41fdc24e6 100644 --- a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs +++ b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs @@ -13,8 +13,10 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.Internal.EmbeddedLanguages { - [ExportEmbeddedLanguageBraceMatcherInternal( - nameof(AspNetCoreEmbeddedLanguageBraceMatcher), LanguageNames.CSharp, supportsUnannotatedAPIs: false, + [ExportEmbeddedLanguageBraceMatcher( + nameof(AspNetCoreEmbeddedLanguageBraceMatcher), + new[] { LanguageNames.CSharp }, + supportsUnannotatedAPIs: false, // Add more syntax names here in the future if there are additional cases ASP.Net would like to light up on. identifiers: new[] { "Route" }), Shared] internal class AspNetCoreEmbeddedLanguageBraceMatcher : IEmbeddedLanguageBraceMatcher diff --git a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs index d3d16fddda079..9387445142ccc 100644 --- a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs +++ b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs @@ -10,8 +10,10 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.Internal.EmbeddedLanguages { - [ExportEmbeddedLanguageClassifierInternal( - nameof(AspNetCoreEmbeddedLanguageClassifier), LanguageNames.CSharp, supportsUnannotatedAPIs: false, + [ExportEmbeddedLanguageClassifier( + nameof(AspNetCoreEmbeddedLanguageClassifier), + new[] { LanguageNames.CSharp }, + supportsUnannotatedAPIs: false, // Add more syntax names here in the future if there are additional cases ASP.Net would like to light up on. identifiers: new[] { "Route" }), Shared] internal class AspNetCoreEmbeddedLanguageClassifier : IEmbeddedLanguageClassifier diff --git a/src/Workspaces/CSharp/Portable/EmbeddedLanguages/LanguageServices/CSharpEmbeddedLanguagesProvider.cs b/src/Workspaces/CSharp/Portable/EmbeddedLanguages/LanguageServices/CSharpEmbeddedLanguagesProvider.cs index 0a2a0f42f5a37..bef2dce2125c4 100644 --- a/src/Workspaces/CSharp/Portable/EmbeddedLanguages/LanguageServices/CSharpEmbeddedLanguagesProvider.cs +++ b/src/Workspaces/CSharp/Portable/EmbeddedLanguages/LanguageServices/CSharpEmbeddedLanguagesProvider.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Composition; using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars; @@ -23,7 +21,7 @@ internal class CSharpEmbeddedLanguagesProvider : AbstractEmbeddedLanguagesProvid [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpEmbeddedLanguagesProvider() + public CSharpEmbeddedLanguagesProvider() : base(Info) { } } diff --git a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/AbstractEmbeddedLanguageClassificationService.cs b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/AbstractEmbeddedLanguageClassificationService.cs index e1a2ae10a2451..63d1937960821 100644 --- a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/AbstractEmbeddedLanguageClassificationService.cs +++ b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/AbstractEmbeddedLanguageClassificationService.cs @@ -47,6 +47,9 @@ public async Task AddEmbeddedLanguageClassificationsAsync( public void AddEmbeddedLanguageClassifications( Project? project, SemanticModel semanticModel, TextSpan textSpan, ClassificationOptions options, ArrayBuilder result, CancellationToken cancellationToken) { + if (project is null) + return; + var root = semanticModel.SyntaxTree.GetRoot(cancellationToken); var worker = new Worker(this, project, semanticModel, textSpan, options, result, cancellationToken); worker.Recurse(root); @@ -55,7 +58,7 @@ public void AddEmbeddedLanguageClassifications( private ref struct Worker { private readonly AbstractEmbeddedLanguageClassificationService _owner; - private readonly Project? _project; + private readonly Project _project; private readonly SemanticModel _semanticModel; private readonly TextSpan _textSpan; private readonly ClassificationOptions _options; @@ -64,7 +67,7 @@ private ref struct Worker public Worker( AbstractEmbeddedLanguageClassificationService service, - Project? project, + Project project, SemanticModel semanticModel, TextSpan textSpan, ClassificationOptions options, diff --git a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/EmbeddedLanguageClassifierContext.cs b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/EmbeddedLanguageClassifierContext.cs index 978224cee5bc0..38882fad3998b 100644 --- a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/EmbeddedLanguageClassifierContext.cs +++ b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/EmbeddedLanguageClassifierContext.cs @@ -14,7 +14,7 @@ internal struct EmbeddedLanguageClassificationContext { private readonly ArrayBuilder _result; - public Project? Project { get; } + public Project Project { get; } /// /// The string or character token to classify. @@ -32,7 +32,7 @@ internal struct EmbeddedLanguageClassificationContext internal readonly IVirtualCharService VirtualCharService; internal EmbeddedLanguageClassificationContext( - Project? project, + Project project, SemanticModel semanticModel, SyntaxToken syntaxToken, ClassificationOptions options, diff --git a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs index b9214d27103dc..896e99b644c8b 100644 --- a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs +++ b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs @@ -2,9 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Immutable; -using System.Composition; using Microsoft.CodeAnalysis.EmbeddedLanguages; namespace Microsoft.CodeAnalysis.Classification @@ -12,57 +9,18 @@ namespace Microsoft.CodeAnalysis.Classification /// /// Use this attribute to export a . /// - [MetadataAttribute] - [AttributeUsage(AttributeTargets.Class)] - internal class ExportEmbeddedLanguageClassifierAttribute : ExportAttribute + internal class ExportEmbeddedLanguageClassifierAttribute : ExportEmbeddedLanguageFeatureServiceAttribute { - /// - /// Name of the classifier. - /// - public string Name { get; } - - /// - /// Name of the containing language hosting the embedded language. e.g. C# or VB. - /// - public string Language { get; } - - /// - /// Identifiers in code (or StringSyntaxAttribute) used to identify an embedded language string. For example - /// Regex or Json. - /// - /// This can be used to find usages of an embedded language using a comment marker like // - /// lang=regex or passed to a symbol annotated with [StringSyntaxAttribyte("Regex")]. The identifier - /// is case sensitive for the StringSyntaxAttribute, and case insensitive for the comment. - /// - public string[] Identifiers { get; } - public ExportEmbeddedLanguageClassifierAttribute( - string name, string language, params string[] identifiers) - : base(typeof(IEmbeddedLanguageClassifier)) + string name, string[] languages, params string[] identifiers) + : this(name, languages, supportsUnannotatedAPIs: false, identifiers) { - Name = name ?? throw new ArgumentNullException(nameof(name)); - Language = language ?? throw new ArgumentNullException(nameof(language)); - Identifiers = identifiers ?? throw new ArgumentNullException(nameof(identifiers)); } - } - /// - /// Internal version of . Used so we can allow regex/json to - /// still light up on legacy APIs not using the new [StringSyntax] attribute the runtime added. For public - /// extensions that's the only mechanism we support. - /// - [MetadataAttribute] - [AttributeUsage(AttributeTargets.Class)] - internal sealed class ExportEmbeddedLanguageClassifierInternalAttribute : ExportEmbeddedLanguageClassifierAttribute - { - /// - public bool SupportsUnannotatedAPIs { get; } - - public ExportEmbeddedLanguageClassifierInternalAttribute( - string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) - : base(name, language, identifiers) + public ExportEmbeddedLanguageClassifierAttribute( + string name, string[] languages, bool supportsUnannotatedAPIs, params string[] identifiers) + : base(typeof(IEmbeddedLanguageClassifier), name, languages, supportsUnannotatedAPIs, identifiers) { - SupportsUnannotatedAPIs = supportsUnannotatedAPIs; } } } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageFeatureService.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageFeatureService.cs index a9209880d1d18..56d4a56a79976 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageFeatureService.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageFeatureService.cs @@ -53,7 +53,7 @@ protected AbstractEmbeddedLanguageFeatureService( IEnumerable> allServices) { // Order the classifiers to respect the [Order] annotations. - var orderedClassifiers = ExtensionOrderer.Order(allServices).Where(c => c.Metadata.Language == languageName).ToImmutableArray(); + var orderedClassifiers = ExtensionOrderer.Order(allServices).Where(c => c.Metadata.Languages.Contains(languageName)).ToImmutableArray(); // Grab out the services that handle unannotated literals and APIs. _legacyServices = orderedClassifiers.WhereAsArray(c => c.Metadata.SupportsUnannotatedAPIs); diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguagesProvider.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguagesProvider.cs index 9710b6ca38f33..f4e57f9ab670f 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguagesProvider.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguagesProvider.cs @@ -12,10 +12,12 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages internal abstract class AbstractEmbeddedLanguagesProvider : IEmbeddedLanguagesProvider { public virtual ImmutableArray Languages { get; } + public EmbeddedLanguageInfo EmbeddedLanguageInfo { get; } - protected AbstractEmbeddedLanguagesProvider() + protected AbstractEmbeddedLanguagesProvider(EmbeddedLanguageInfo info) { Languages = ImmutableArray.Empty; + EmbeddedLanguageInfo = info; } } } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageInfo.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageInfo.cs index 9553e2b3ccf9d..85e268d45c3c2 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageInfo.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageInfo.cs @@ -4,6 +4,7 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Collections; diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageMetadata.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageMetadata.cs index a5c38cd15caee..6f2b27a061d05 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageMetadata.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageMetadata.cs @@ -8,13 +8,15 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages { - internal class EmbeddedLanguageMetadata : OrderableLanguageMetadata + internal class EmbeddedLanguageMetadata : OrderableMetadata, ILanguagesMetadata { /// /// The particular language-IDs this language supports (for example 'regex/regexp/etc.'). /// public IEnumerable Identifiers { get; } + public IEnumerable Languages { get; } + /// /// If this language supports strings being passed to APIs that do not have a // lang=... comment or a /// [StringSyntax] attribute on them. This is not exposed publicly as all modern language plugins should @@ -27,14 +29,16 @@ public EmbeddedLanguageMetadata(IDictionary data) : base(data) { this.Identifiers = ((IReadOnlyDictionary)data).GetEnumerableMetadata(nameof(Identifiers)).WhereNotNull(); + this.Languages = ((IReadOnlyDictionary)data).GetEnumerableMetadata(nameof(Languages)).WhereNotNull(); this.SupportsUnannotatedAPIs = data.GetValueOrDefault(nameof(SupportsUnannotatedAPIs)) is bool b ? b : false; } public EmbeddedLanguageMetadata( - string name, string language, IEnumerable after, IEnumerable before, IEnumerable identifiers, bool supportsUnannotatedAPIs) - : base(name, language, after, before) + string name, IEnumerable languages, IEnumerable after, IEnumerable before, IEnumerable identifiers, bool supportsUnannotatedAPIs) + : base(name, after, before) { this.Identifiers = identifiers; + this.Languages = languages; SupportsUnannotatedAPIs = supportsUnannotatedAPIs; } } diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/ExportEmbeddedLanguageFeatureServiceAttribute.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/ExportEmbeddedLanguageFeatureServiceAttribute.cs new file mode 100644 index 0000000000000..7bf1796a1c5ee --- /dev/null +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/ExportEmbeddedLanguageFeatureServiceAttribute.cs @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Classification; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.EmbeddedLanguages +{ + /// + /// Use this attribute to export an . + /// + [MetadataAttribute] + [AttributeUsage(AttributeTargets.Class)] + internal abstract class ExportEmbeddedLanguageFeatureServiceAttribute : ExportAttribute + { + /// + /// Name of the classifier. + /// + public string Name { get; } + + /// + /// Names of the containing language hosting the embedded language. e.g. C# or VB. + /// + public string[] Languages { get; } + + /// + /// Identifiers in code (or StringSyntaxAttribute) used to identify an embedded language string. For example + /// Regex or Json. + /// + /// This can be used to find usages of an embedded language using a comment marker like // + /// lang=regex or passed to a symbol annotated with [StringSyntaxAttribyte("Regex")]. The identifier + /// is case sensitive for the StringSyntaxAttribute, and case insensitive for the comment. + /// + public string[] Identifiers { get; } + + /// + internal bool SupportsUnannotatedAPIs { get; } + + public ExportEmbeddedLanguageFeatureServiceAttribute( + Type contractType, string name, string[] languages, params string[] identifiers) + : this(contractType, name, languages, supportsUnannotatedAPIs: false, identifiers) + { + } + + internal ExportEmbeddedLanguageFeatureServiceAttribute( + Type contractType, string name, string[] languages, bool supportsUnannotatedAPIs, params string[] identifiers) + : base(contractType) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Languages = languages ?? throw new ArgumentNullException(nameof(languages)); + Identifiers = identifiers ?? throw new ArgumentNullException(nameof(identifiers)); + SupportsUnannotatedAPIs = supportsUnannotatedAPIs; + + Contract.ThrowIfFalse(contractType.IsInterface && typeof(IEmbeddedLanguageFeatureService).IsAssignableFrom(contractType), + $"{nameof(contractType)} must be an interface and derived from {typeof(IEmbeddedLanguageFeatureService).FullName}"); + + if (SupportsUnannotatedAPIs) + { + Contract.ThrowIfFalse(name is PredefinedEmbeddedLanguageNames.Regex or PredefinedEmbeddedLanguageNames.Json, + $"Only '{PredefinedEmbeddedLanguageNames.Regex}' or '{PredefinedEmbeddedLanguageNames.Json}' are allowed to '{nameof(SupportsUnannotatedAPIs)}'"); + } + } + } +} diff --git a/src/Workspaces/Core/Portable/EmbeddedLanguages/IEmbeddedLanguagesProvider.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/IEmbeddedLanguagesProvider.cs index f425be92ba644..8dc483d351ccd 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/IEmbeddedLanguagesProvider.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/IEmbeddedLanguagesProvider.cs @@ -15,6 +15,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages /// internal interface IEmbeddedLanguagesProvider : ILanguageService { + EmbeddedLanguageInfo EmbeddedLanguageInfo { get; } ImmutableArray Languages { get; } } } diff --git a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/PredefinedEmbeddedLanguageClassifierNames.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/PredefinedEmbeddedLanguageClassifierNames.cs similarity index 73% rename from src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/PredefinedEmbeddedLanguageClassifierNames.cs rename to src/Workspaces/Core/Portable/EmbeddedLanguages/PredefinedEmbeddedLanguageClassifierNames.cs index 94e9a645b8e4c..567234a4e5f9a 100644 --- a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/PredefinedEmbeddedLanguageClassifierNames.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/PredefinedEmbeddedLanguageClassifierNames.cs @@ -2,9 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -namespace Microsoft.CodeAnalysis.Classification +namespace Microsoft.CodeAnalysis { - internal static class PredefinedEmbeddedLanguageClassifierNames + internal static class PredefinedEmbeddedLanguageNames { public const string Regex = nameof(Regex); diff --git a/src/Workspaces/VisualBasic/Portable/EmbeddedLanguages/LanguageServices/VisualBasicEmbeddedLanguagesProvider.vb b/src/Workspaces/VisualBasic/Portable/EmbeddedLanguages/LanguageServices/VisualBasicEmbeddedLanguagesProvider.vb index 66c41587770dc..66a4198d3d872 100644 --- a/src/Workspaces/VisualBasic/Portable/EmbeddedLanguages/LanguageServices/VisualBasicEmbeddedLanguagesProvider.vb +++ b/src/Workspaces/VisualBasic/Portable/EmbeddedLanguages/LanguageServices/VisualBasicEmbeddedLanguagesProvider.vb @@ -21,6 +21,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices Public Sub New() + MyBase.New(Info) End Sub End Class End Namespace