From 87fe133641c3ad29da6a89b7cf5e7154a75e9117 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 9 Jun 2022 12:03:46 +0530 Subject: [PATCH 01/28] Fix BuildActionTelemetryTable tool Follow up to https://github.com/dotnet/roslyn/pull/60480. The above PR led to us logging provider name instead of code action name in the telemetry when provider is using CodeAction.Create helper to create a code action. This broke the CodeActionDescriptionMap within the BuildActionTelemetryTable tool that is used to search for code action telemetry in Kusto. This PR regenerates the CodeActionDescriptionMap. I have added a helper method to the tool which can be used when required to regenerate this description map in future. --- .../BuildActionTelemetryTable/Program.cs | 590 ++++++++++++------ 1 file changed, 396 insertions(+), 194 deletions(-) diff --git a/src/Tools/BuildActionTelemetryTable/Program.cs b/src/Tools/BuildActionTelemetryTable/Program.cs index 6b93c95f8a1d8..65df8953b3c5b 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; @@ -35,259 +36,398 @@ public class Program 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.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 Null Check Over Type Check" }, + { "Microsoft.CodeAnalysis.CSharp.UseInferredMemberName.CSharpUseInferredMemberNameCodeFixProvider", "Use Inferred Member Name" }, { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseIndexOperatorCodeFixProvider", "Use Index Operator" }, { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseRangeOperatorCodeFixProvider", "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 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 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 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.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.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" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckWithoutNameCodeFixProvider", "Is And Cast Check Without Name" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpUseNotPatternCodeFixProvider", "Use Not Pattern" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpAsAndNullCheckCodeFixProvider", "As And Null Check" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckCodeFixProvider", "Is And Cast Check" }, + { "Microsoft.CodeAnalysis.CSharp.UseNamedArguments.CSharpUseNamedArgumentsCodeRefactoringProvider", "Use Named Arguments" }, { "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.UseExpressionBodyCodeRefactoringProvider", "Use Expression Body" }, + { "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" }, { "Microsoft.CodeAnalysis.CSharp.UseExplicitTypeForConst.UseExplicitTypeForConstCodeFixProvider", "Use Explicit Type For Const" }, + { "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", "Merge Consecutive If Statements" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Into Nested If Statements" }, + { "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" }, + { "Microsoft.CodeAnalysis.CSharp.ReplaceDocCommentTextWithTag.CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider", "Replace Doc Comment Text With Tag" }, { "Microsoft.CodeAnalysis.CSharp.ReplaceDefaultLiteral.CSharpReplaceDefaultLiteralCodeFixProvider", "Replace Default Literal" }, + { "Microsoft.CodeAnalysis.CSharp.ReplaceConditionalWithStatements.CSharpReplaceConditionalWithStatementsCodeRefactoringProvider", "Replace Conditional With Statements" }, + { "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" }, + { "Microsoft.CodeAnalysis.CSharp.MoveDeclarationNearReference.CSharpMoveDeclarationNearReferenceCodeRefactoringProvider", "Move Declaration Near Reference" }, { "Microsoft.CodeAnalysis.CSharp.MakeRefStruct.MakeRefStructCodeFixProvider", "Make Ref Struct" }, - { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticCodeFixProvider", "Make Local Function Static (CodeFix)" }, - { "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.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" }, + { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.PassInCapturedVariablesAsArgumentsCodeFixProvider", "Pass In Captured Variables As Arguments" }, + { "Microsoft.CodeAnalysis.CSharp.InvertLogical.CSharpInvertLogicalCodeRefactoringProvider", "Invert Logical" }, + { "Microsoft.CodeAnalysis.CSharp.InvertIf.CSharpInvertIfCodeRefactoringProvider", "Invert If" }, + { "Microsoft.CodeAnalysis.CSharp.InvertConditional.CSharpInvertConditionalCodeRefactoringProvider", "Invert Conditional" }, + { "Microsoft.CodeAnalysis.CSharp.IntroduceVariable.CSharpIntroduceLocalForExpressionCodeRefactoringProvider", "Introduce Local For Expression" }, + { "Microsoft.CodeAnalysis.CSharp.IntroduceVariable.CSharpIntroduceParameterCodeRefactoringProvider", "Introduce Parameter" }, + { "Microsoft.CodeAnalysis.CSharp.IntroduceUsingStatement.CSharpIntroduceUsingStatementCodeRefactoringProvider", "Introduce Using Statement" }, + { "Microsoft.CodeAnalysis.CSharp.InitializeParameter.CSharpAddParameterCheckCodeRefactoringProvider", "Add Parameter Check" }, + { "Microsoft.CodeAnalysis.CSharp.InitializeParameter.CSharpInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Member From Parameter" }, + { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementExplicitlyCodeRefactoringProvider", "Implement Explicitly" }, + { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementImplicitlyCodeRefactoringProvider", "Implement Implicitly" }, + { "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" }, + { "Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.CSharpJsonDetectionCodeFixProvider", "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.ConvertTupleToStruct.CSharpConvertTupleToStructCodeRefactoringProvider", "Convert Tuple To Struct" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToRawString.ConvertRegularStringToRawStringCodeRefactoringProvider", "Convert Regular String To Raw String" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertConcatenationToInterpolatedStringRefactoringProvider", "Convert Concatenation To Interpolated String" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert Placeholder To Interpolated String" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeFixProvider", "Convert To Program Main" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeRefactoringProvider", "Convert To Program Main" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeFixProvider", "Convert To Top Level Statements" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeRefactoringProvider", "Convert To Top Level Statements" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertNumericLiteral.CSharpConvertNumericLiteralCodeRefactoringProvider", "Convert Numeric Literal" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeRefactoringProvider", "Convert Namespace" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeFixProvider", "Convert Namespace" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertLinq.CSharpConvertLinqQueryToForEachProvider", "Convert Linq Query To For Each Provider" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertLinq.ConvertForEachToLinqQuery.CSharpConvertForEachToLinqQueryProvider", "Convert For Each To Linq Query Provider" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertIfToSwitch.CSharpConvertIfToSwitchCodeRefactoringProvider", "Convert If To Switch" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertForToForEach.CSharpConvertForToForEachCodeRefactoringProvider", "Convert For To For Each" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertForEachToFor.CSharpConvertForEachToForCodeRefactoringProvider", "Convert For Each To For" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertCast.CSharpConvertDirectCastToTryCastCodeRefactoringProvider", "Convert Direct Cast To Try Cast" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertCast.CSharpConvertTryCastToDirectCastCodeRefactoringProvider", "Convert Try Cast To Direct Cast" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.ConvertBetweenRegularAndVerbatimInterpolatedStringCodeRefactoringProvider", "Convert Between Regular And Verbatim Interpolated String" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.ConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider", "Convert Between Regular And Verbatim String" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertAutoPropertyToFullProperty.CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider", "Convert Auto Property To Full Property" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousType.CSharpConvertAnonymousTypeToClassCodeRefactoringProvider", "Convert Anonymous Type To Class" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousType.CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider", "Convert Anonymous Type To Tuple" }, + { "Microsoft.CodeAnalysis.CSharp.ConflictMarkerResolution.CSharpResolveConflictMarkerCodeFixProvider", "Resolve Conflict Marker" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseRecursivePatterns.UseRecursivePatternsCodeRefactoringProvider", "Use Recursive Patterns" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseImplicitType.UseImplicitTypeCodeRefactoringProvider", "Use Implicit Type" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseExplicitType.UseExplicitTypeCodeRefactoringProvider", "Use Explicit Type" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.SyncNamespace.CSharpSyncNamespaceCodeRefactoringProvider", "Sync Namespace" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.PullMemberUp.CSharpPullMemberUpCodeRefactoringProvider", "Pull Member Up" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.MoveStaticMembers.CSharpMoveStaticMembersRefactoringProvider", "Move Static Members" }, { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineTemporary.CSharpInlineTemporaryCodeRefactoringProvider", "Inline Temporary" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider", "Enable nullable" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineMethod.CSharpInlineMethodRefactoringProvider", "Inline Method" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ExtractClass.CSharpExtractClassCodeRefactoringProvider", "Extract Class" }, + { "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.CodeRefactorings.AddMissingImports.CSharpAddMissingImportsRefactoringProvider", "Add Missing Imports" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.AddAwait.CSharpAddAwaitCodeRefactoringProvider", "Add Await" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.TransposeRecordKeyword.CSharpTransposeRecordKeywordCodeFixProvider", "Transpose Record Keyword" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.MatchFolderAndNamespace.CSharpChangeNamespaceToMatchFolderCodeFixProvider", "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.CSharpChangeToIEnumerableCodeFixProvider", "Change To I Enumerable" }, + { "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 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", "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 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" }, + { "Microsoft.CodeAnalysis.CSharp.AddDebuggerDisplay.CSharpAddDebuggerDisplayCodeRefactoringProvider", "Add Debugger Display" }, + { "Microsoft.CodeAnalysis.CSharp.AddAnonymousTypeMemberName.CSharpAddAnonymousTypeMemberNameCodeFixProvider", "Add Anonymous Type Member Name" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider+CustomCodeAction", "Custom" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.HideBase.HideBaseCodeFixProvider+AddNewKeywordAction", "Add New Keyword Action" }, + { "Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingCodeRefactoringProvider", "Rename Tracking" }, + { "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.SimplifyBooleanExpression.SimplifyConditionalCodeFixProvider", "Simplify Conditional" }, { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryInlineSuppressionsCodeFixProvider", "Remove Unnecessary Inline Suppressions" }, { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryAttributeSuppressionsCodeFixProvider", "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", "Wrap Items Action" }, + { "Microsoft.CodeAnalysis.UpgradeProject.ProjectOptionsChangeAction", "Project Options Change Action" }, + { "Microsoft.CodeAnalysis.ReplacePropertyWithMethods.ReplacePropertyWithMethodsCodeRefactoringProvider", "Replace Property With Methods" }, + { "Microsoft.CodeAnalysis.ReplaceMethodWithProperty.ReplaceMethodWithPropertyCodeRefactoringProvider", "Replace Method With Property" }, + { "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" }, + { "Microsoft.CodeAnalysis.GenerateOverrides.GenerateOverridesCodeRefactoringProvider", "Generate Overrides" }, + { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider", "Generate Equals And Get Hash Code From Members" }, + { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.GenerateDefaultConstructorsCodeRefactoringProvider", "Generate Default Constructors" }, + { "Microsoft.CodeAnalysis.GenerateComparisonOperators.GenerateComparisonOperatorsCodeRefactoringProvider", "Generate Comparison Operators" }, + { "Microsoft.CodeAnalysis.ExtractInterface.ExtractInterfaceCodeAction", "Extract Interface" }, + { "Microsoft.CodeAnalysis.ExtractInterface.ExtractInterfaceCodeRefactoringProvider", "Extract Interface" }, + { "Microsoft.CodeAnalysis.ExtractClass.ExtractClassWithDialogCodeAction", "Extract Class With Dialog" }, + { "Microsoft.CodeAnalysis.EncapsulateField.EncapsulateFieldRefactoringProvider", "Encapsulate Field" }, + { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.ConvertRegularStringToInterpolatedStringRefactoringProvider", "Convert Regular String To Interpolated String" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.FixAllCodeRefactoringCodeAction", "Fix All Code Refactoring" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.MoveType.MoveTypeCodeRefactoringProvider", "Move Type" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.ExtractMethodCodeRefactoringProvider", "Extract Method" }, + { "Microsoft.CodeAnalysis.CodeFixes.FixMultipleCodeAction", "Fix Multiple" }, + { "Microsoft.CodeAnalysis.CodeFixes.NamingStyles.NamingStyleCodeFixProvider", "Naming Style" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.TopLevelSuppressionCodeAction", "Top Level Suppression" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.WrapperCodeFixProvider", "Wrapper" }, + { "Microsoft.CodeAnalysis.ChangeSignature.ChangeSignatureCodeRefactoringProvider", "Change Signature" }, + { "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.AddConstructorParametersFromMembers.AddConstructorParametersFromMembersCodeRefactoringProvider", "Add Constructor Parameters From Members" }, { "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.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.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.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.GenerateType.AbstractGenerateTypeService`6+GenerateTypeCodeActionWithOption", "Generate Type" }, { "Microsoft.CodeAnalysis.GenerateOverrides.GenerateOverridesCodeRefactoringProvider+GenerateOverridesWithDialogCodeAction", "Generate Overrides With Dialog" }, { "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.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" }, + { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeWithDialogCodeAction", "Generate Equals And Get Hash Code With Dialog" }, + { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+GenerateDefaultConstructorCodeAction", "Generate Default Constructor" }, + { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+CodeActionAll", "Code Action All" }, + { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+ConstructorDelegatingCodeAction", "Constructor Delegating" }, + { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+FieldDelegatingCodeAction", "Field Delegating" }, + { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+GenerateConstructorWithDialogCodeAction", "Generate Constructor With Dialog" }, + { "Microsoft.CodeAnalysis.CodeStyle.AbstractCodeStyleProvider`2+CodeRefactoringProvider", "" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.PullMemberUp.AbstractPullMemberUpRefactoringProvider+PullMemberUpWithDialogCodeAction", "Pull Member Up With Dialog" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.SyncNamespace.AbstractSyncNamespaceCodeRefactoringProvider`3+MoveFileCodeAction", "Move File" }, { "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.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.NamingStyles.NamingStyleCodeFixProvider+FixNameCodeAction", "Fix Name" }, + { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider+GroupingCodeAction", "Grouping" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageCodeAction", "Global Suppress Message" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction", "Global Suppress Message Fix All" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+LocalSuppressMessageCodeAction", "Local Suppress Message" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+PragmaWarningCodeAction", "Pragma Warning" }, + { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelBulkConfigureSeverityCodeAction", "Top Level Bulk Configure Severity" }, + { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelConfigureSeverityCodeAction", "Top Level Configure Severity" }, + { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureCodeStyle.ConfigureCodeStyleOptionCodeFixProvider+TopLevelConfigureCodeStyleOptionCodeAction", "Top Level Configure Code Style Option" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+AssemblyReferenceCodeAction", "Assembly Reference" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallPackageAndAddImportCodeAction", "Install Package And Add Import" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallWithPackageManagerCodeAction", "Install With Package Manager" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+MetadataSymbolReferenceCodeAction", "Metadata Symbol Reference" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ParentInstallPackageCodeAction", "Parent Install Package" }, + { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ProjectSymbolReferenceCodeAction", "Project Symbol Reference" }, + { "Microsoft.CodeAnalysis.AddConstructorParametersFromMembers.AddConstructorParametersFromMembersCodeRefactoringProvider+AddConstructorParametersCodeAction", "Add Constructor Parameters" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction+GlobalSuppressionSolutionChangeAction", "Global Suppression Solution Change Action" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+AttributeRemoveAction", "Attribute Remove Action" }, + { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+PragmaRemoveAction", "Pragma Remove Action" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddAnonymousTypeMemberName.VisualBasicAddAnonymousTypeMemberNameCodeFixProvider", "Add Anonymous Type Member Name" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddDebuggerDisplay.VisualBasicAddDebuggerDisplayCodeRefactoringProvider", "Add Debugger Display" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddFileBanner.VisualBasicAddFileBannerCodeRefactoringProvider", "Add File Banner" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddImport.VisualBasicAddImportCodeFixProvider", "Add Import" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddPackage.VisualBasicAddSpecificPackageCodeFixProvider", "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.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.GenerateEnumMember.GenerateEnumMemberCodeFixProvider", "Generate Enum Member" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEvent.GenerateEventCodeFixProvider", "Generate Event" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateMethod.GenerateConversionCodeFixProvider", "Generate Conversion" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateMethod.GenerateParameterizedMemberCodeFixProvider", "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", "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.OverloadBase.OverloadBaseCodeFixProvider+AddKeywordAction", "Overload Base: Add Keyword" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.AddAwait.VisualBasicAddAwaitCodeRefactoringProvider", "Add Await" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineMethodRefactoringProvider", "Inline Method" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineTemporaryCodeRefactoringProvider", "Inline Temporary" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.MoveStaticMembers.VisualBasicMoveStaticMembersRefactoringProvider", "Move Static Members" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeActions.RemoveStatementCodeAction", "Remove Statement" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConflictMarkerResolution.VisualBasicResolveConflictMarkerCodeFixProvider", "Resolve Conflict Marker" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertAnonymousType.VisualBasicConvertAnonymousTypeToClassCodeRefactoringProvider", "Convert Anonymous Type To Class" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertAnonymousTypeToTuple.VisualBasicConvertAnonymousTypeToTupleCodeRefactoringProvider", "Convert Anonymous Type To Tuple" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertAutoPropertyToFullProperty.VisualBasicConvertAutoPropertyToFullPropertyCodeRefactoringProvider", "Convert Auto Property To Full Property" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertCast.VisualBasicConvertDirectCastToTryCastCodeRefactoringProvider", "Convert Direct Cast To Try Cast" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertConversionOperators.VisualBasicConvertTryCastToDirectCastCodeRefactoringProvider", "Convert Try Cast To Direct Cast" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertForEachToFor.VisualBasicConvertForEachToForCodeRefactoringProvider", "Convert For Each To For" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertForToForEach.VisualBasicConvertForToForEachCodeRefactoringProvider", "Convert For To For Each" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertIfToSwitch.VisualBasicConvertIfToSwitchCodeRefactoringProvider", "Convert If To Switch" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertNumericLiteral.VisualBasicConvertNumericLiteralCodeRefactoringProvider", "Convert Numeric Literal" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString.VisualBasicConvertConcatenationToInterpolatedStringRefactoringProvider", "Convert Concatenation To Interpolated String" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString.VisualBasicConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert Placeholder To Interpolated String" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertTupleToStruct.VisualBasicConvertTupleToStructCodeRefactoringProvider", "Convert Tuple To Struct" }, + { "Microsoft.CodeAnalysis.VisualBasic.Features.EmbeddedLanguages.VisualBasicJsonDetectionCodeFixProvider", "Json Detection" }, + { "Microsoft.CodeAnalysis.VisualBasic.GenerateConstructorFromMembers.VisualBasicGenerateConstructorFromMembersCodeRefactoringProvider", "Generate Constructor From Members" }, + { "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", "Add Parameter Check" }, + { "Microsoft.CodeAnalysis.VisualBasic.InitializeParameter.VisualBasicInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Member From Parameter" }, + { "Microsoft.CodeAnalysis.VisualBasic.IntroduceUsingStatement.VisualBasicIntroduceUsingStatementCodeRefactoringProvider", "Introduce Using Statement" }, + { "Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable.VisualBasicIntroduceLocalForExpressionCodeRefactoringProvider", "Introduce Local For Expression" }, + { "Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable.VisualBasicIntroduceParameterCodeRefactoringProvider", "Introduce Parameter" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertConditional.VisualBasicInvertConditionalCodeRefactoringProvider", "Invert Conditional" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertIf.VisualBasicInvertMultiLineIfCodeRefactoringProvider", "Invert Multi Line If" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertIf.VisualBasicInvertSingleLineIfCodeRefactoringProvider", "Invert Single Line If" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertLogical.VisualBasicInvertLogicalCodeRefactoringProvider", "Invert Logical" }, + { "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" }, + { "Microsoft.CodeAnalysis.VisualBasic.NameTupleElement.VisualBasicNameTupleElementCodeRefactoringProvider", "Name Tuple Element" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveAsyncModifier.VisualBasicRemoveAsyncModifierCodeFixProvider", "Remove Async Modifier" }, { "Microsoft.CodeAnalysis.VisualBasic.RemoveSharedFromModuleMembers.VisualBasicRemoveSharedFromModuleMembersCodeFixProvider", "Remove Shared From Module Members" }, - { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryByVal.VisualBasicRemoveUnnecessaryByValCodeFixProvider", "Remove Unnecessary ByVal" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnusedVariable.VisualBasicRemoveUnusedVariableCodeFixProvider", "Remove Unused Variable" }, + { "Microsoft.CodeAnalysis.VisualBasic.ReplaceConditionalWithStatements.VisualBasicReplaceConditionalWithStatementsCodeRefactoringProvider", "Replace Conditional With Statements" }, + { "Microsoft.CodeAnalysis.VisualBasic.ReplaceDocCommentTextWithTag.VisualBasicReplaceDocCommentTextWithTagCodeRefactoringProvider", "Replace Doc Comment Text With Tag" }, + { "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", "Merge Consecutive If Statements" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Into Nested If Statements" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseAutoProperty.VisualBasicUseAutoPropertyCodeFixProvider", "Use Auto Property" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseNamedArguments.VisualBasicUseNamedArgumentsCodeRefactoringProvider", "Use Named Arguments" }, + { "Microsoft.CodeAnalysis.VisualBasic.Wrapping.VisualBasicWrappingCodeRefactoringProvider", "Wrapping" }, + { "Microsoft.CodeAnalysis.VisualBasic.AddAccessibilityModifiers.VisualBasicAddAccessibilityModifiersCodeFixProvider", "Add Accessibility Modifiers" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertTypeOfToNameOf.VisualBasicConvertGetTypeToNameOfCodeFixProvider", "Convert Get Type To Name Of" }, + { "Microsoft.CodeAnalysis.VisualBasic.FileHeaders.VisualBasicFileHeaderCodeFixProvider", "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.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.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 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.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.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" }, + { "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", "Add Keyword" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+ReplaceKeywordCodeAction", "Replace Keyword" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+ReplaceTokenKeywordCodeAction", "Replace Token Keyword" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.MoveToTopOfFile.MoveToTopOfFileCodeFixProvider+MoveToLineCodeAction", "Move To Line" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.OverloadBase.OverloadBaseCodeFixProvider+AddKeywordAction", "Add Keyword Action" }, + { "Microsoft.CodeAnalysis.CodeFixesAndRefactorings.DocumentBasedFixAllProviderHelpers+PostProcessCodeAction", "Post Process" }, }.ToImmutableDictionary(); public static void Main(string[] args) @@ -405,6 +545,68 @@ 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("{"); + + var regex = new Regex(@" + (?<=[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[] { "CSharp", "VisualBasic" }; + var suffixStrings = new[] { "CodeFixProvider", "CodeRefactoringProvider", "RefactoringProvider", + "CodeAction", "CodeActionWithOption", "CodeActionProvider" }; + + foreach (var (actionOrProviderTypeName, _) in telemetryInfos) + { + if (IgnoredCodeActions.Contains(actionOrProviderTypeName)) + { + continue; + } + + // We create the description string from the core type name after omitting the well-known prefixes and suffixes. + + var description = actionOrProviderTypeName.Split(".").Last(); + + // Handle nested types + if (description.Contains("+")) + { + description = description.Substring(description.LastIndexOf("+") + 1); + } + + foreach (var prefix in prefixStrings) + { + if (description.StartsWith(prefix)) + { + description = description.Substring(prefix.Length); + break; + } + } + + foreach (var suffix in suffixStrings) + { + if (description.EndsWith(suffix)) + { + description = description.Substring(0, description.LastIndexOf(suffix)); + break; + } + } + + description = regex.Replace(description, " "); + + builder.AppendLine(@$" {{ ""{actionOrProviderTypeName}"", ""{description}"" }},"); + } + + builder.Append("}"); + + return builder.ToString(); + } + private class FullNameTypeComparer : IEqualityComparer { public static FullNameTypeComparer Instance { get; } = new FullNameTypeComparer(); From 2f000f93b8d0c9ea12f41775fa4aa8e3c08ae7b5 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Fri, 10 Jun 2022 10:47:56 +0530 Subject: [PATCH 02/28] Apply suggestions from code review Co-authored-by: Joey Robichaud --- .../BuildActionTelemetryTable/Program.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Tools/BuildActionTelemetryTable/Program.cs b/src/Tools/BuildActionTelemetryTable/Program.cs index 65df8953b3c5b..eac0c5925a16f 100644 --- a/src/Tools/BuildActionTelemetryTable/Program.cs +++ b/src/Tools/BuildActionTelemetryTable/Program.cs @@ -156,11 +156,11 @@ public class Program { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertConcatenationToInterpolatedStringRefactoringProvider", "Convert Concatenation To Interpolated String" }, { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert Placeholder To Interpolated String" }, { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeFixProvider", "Convert To Program Main" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeRefactoringProvider", "Convert To Program Main" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeRefactoringProvider", "Convert To Program Main (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeFixProvider", "Convert To Top Level Statements" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeRefactoringProvider", "Convert To Top Level Statements" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeRefactoringProvider", "Convert To Top Level Statements (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.ConvertNumericLiteral.CSharpConvertNumericLiteralCodeRefactoringProvider", "Convert Numeric Literal" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeRefactoringProvider", "Convert Namespace" }, + { "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 Provider" }, { "Microsoft.CodeAnalysis.CSharp.ConvertLinq.ConvertForEachToLinqQuery.CSharpConvertForEachToLinqQueryProvider", "Convert For Each To Linq Query Provider" }, @@ -195,7 +195,7 @@ public class Program { "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 I Enumerable" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator.CSharpChangeToIEnumerableCodeFixProvider", "Change To IEnumerable" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.HideBase.HideBaseCodeFixProvider", "Hide Base" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.FixReturnType.CSharpFixReturnTypeCodeFixProvider", "Fix Return Type" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.AddInheritdoc.AddInheritdocCodeFixProvider", "Add Inheritdoc" }, @@ -219,9 +219,9 @@ public class Program { "Microsoft.CodeAnalysis.CSharp.AddFileBanner.CSharpAddFileBannerCodeRefactoringProvider", "Add File Banner" }, { "Microsoft.CodeAnalysis.CSharp.AddDebuggerDisplay.CSharpAddDebuggerDisplayCodeRefactoringProvider", "Add Debugger Display" }, { "Microsoft.CodeAnalysis.CSharp.AddAnonymousTypeMemberName.CSharpAddAnonymousTypeMemberNameCodeFixProvider", "Add Anonymous Type Member Name" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider+CustomCodeAction", "Custom" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider+CustomCodeAction", "Enable Nullable" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.HideBase.HideBaseCodeFixProvider+AddNewKeywordAction", "Add New Keyword Action" }, - { "Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingCodeRefactoringProvider", "Rename Tracking" }, + { "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" }, @@ -249,7 +249,7 @@ public class Program { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.GenerateDefaultConstructorsCodeRefactoringProvider", "Generate Default Constructors" }, { "Microsoft.CodeAnalysis.GenerateComparisonOperators.GenerateComparisonOperatorsCodeRefactoringProvider", "Generate Comparison Operators" }, { "Microsoft.CodeAnalysis.ExtractInterface.ExtractInterfaceCodeAction", "Extract Interface" }, - { "Microsoft.CodeAnalysis.ExtractInterface.ExtractInterfaceCodeRefactoringProvider", "Extract Interface" }, + { "Microsoft.CodeAnalysis.ExtractInterface.ExtractInterfaceCodeRefactoringProvider", "Extract Interface (Refactoring)" }, { "Microsoft.CodeAnalysis.ExtractClass.ExtractClassWithDialogCodeAction", "Extract Class With Dialog" }, { "Microsoft.CodeAnalysis.EncapsulateField.EncapsulateFieldRefactoringProvider", "Encapsulate Field" }, { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.ConvertRegularStringToInterpolatedStringRefactoringProvider", "Convert Regular String To Interpolated String" }, @@ -260,7 +260,7 @@ public class Program { "Microsoft.CodeAnalysis.CodeFixes.NamingStyles.NamingStyleCodeFixProvider", "Naming Style" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.TopLevelSuppressionCodeAction", "Top Level Suppression" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.WrapperCodeFixProvider", "Wrapper" }, - { "Microsoft.CodeAnalysis.ChangeSignature.ChangeSignatureCodeRefactoringProvider", "Change Signature" }, + { "Microsoft.CodeAnalysis.ChangeSignature.ChangeSignatureCodeRefactoringProvider", "Change Signature (Refactoring)" }, { "Microsoft.CodeAnalysis.ChangeSignature.ChangeSignatureCodeAction", "Change Signature" }, { "Microsoft.CodeAnalysis.AddPackage.InstallPackageDirectlyCodeAction", "Install Package Directly" }, { "Microsoft.CodeAnalysis.AddPackage.InstallPackageParentCodeAction", "Install Package Parent" }, @@ -275,7 +275,7 @@ public class Program { "Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction", "Implement Interface" }, { "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" }, + { "Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6+GenerateTypeCodeActionWithOption", "Generate Type With Option" }, { "Microsoft.CodeAnalysis.GenerateOverrides.GenerateOverridesCodeRefactoringProvider+GenerateOverridesWithDialogCodeAction", "Generate Overrides With Dialog" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateVariableCodeAction", "Generate Variable" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateLocalCodeAction", "Generate Local" }, @@ -285,16 +285,16 @@ public class Program { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeAction", "Generate Equals And Get Hash" }, { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeWithDialogCodeAction", "Generate Equals And Get Hash Code With Dialog" }, { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+GenerateDefaultConstructorCodeAction", "Generate Default Constructor" }, - { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+CodeActionAll", "Code Action All" }, - { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+ConstructorDelegatingCodeAction", "Constructor Delegating" }, - { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+FieldDelegatingCodeAction", "Field Delegating" }, + { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+CodeActionAll", "Generate Default Constructor (All)" }, + { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+ConstructorDelegatingCodeAction", "Generate Constructor (Constructor Delegating)" }, + { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+FieldDelegatingCodeAction", "Generate Constructor (Field Delegating)" }, { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+GenerateConstructorWithDialogCodeAction", "Generate Constructor With Dialog" }, { "Microsoft.CodeAnalysis.CodeStyle.AbstractCodeStyleProvider`2+CodeRefactoringProvider", "" }, { "Microsoft.CodeAnalysis.CodeRefactorings.PullMemberUp.AbstractPullMemberUpRefactoringProvider+PullMemberUpWithDialogCodeAction", "Pull Member Up With Dialog" }, { "Microsoft.CodeAnalysis.CodeRefactorings.SyncNamespace.AbstractSyncNamespaceCodeRefactoringProvider`3+MoveFileCodeAction", "Move File" }, { "Microsoft.CodeAnalysis.CodeRefactorings.MoveType.AbstractMoveTypeService`5+MoveTypeCodeAction", "Move Type" }, { "Microsoft.CodeAnalysis.CodeFixes.NamingStyles.NamingStyleCodeFixProvider+FixNameCodeAction", "Fix Name" }, - { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider+GroupingCodeAction", "Grouping" }, + { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider+GroupingCodeAction", "Fully Qualify (Grouping)" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageCodeAction", "Global Suppress Message" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction", "Global Suppress Message Fix All" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+LocalSuppressMessageCodeAction", "Local Suppress Message" }, @@ -302,13 +302,13 @@ public class Program { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelBulkConfigureSeverityCodeAction", "Top Level Bulk Configure Severity" }, { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelConfigureSeverityCodeAction", "Top Level Configure Severity" }, { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureCodeStyle.ConfigureCodeStyleOptionCodeFixProvider+TopLevelConfigureCodeStyleOptionCodeAction", "Top Level Configure Code Style Option" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+AssemblyReferenceCodeAction", "Assembly Reference" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallPackageAndAddImportCodeAction", "Install Package And Add Import" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallWithPackageManagerCodeAction", "Install With Package Manager" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+MetadataSymbolReferenceCodeAction", "Metadata Symbol Reference" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ParentInstallPackageCodeAction", "Parent Install Package" }, - { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ProjectSymbolReferenceCodeAction", "Project Symbol Reference" }, - { "Microsoft.CodeAnalysis.AddConstructorParametersFromMembers.AddConstructorParametersFromMembersCodeRefactoringProvider+AddConstructorParametersCodeAction", "Add Constructor Parameters" }, + { "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" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction+GlobalSuppressionSolutionChangeAction", "Global Suppression Solution Change Action" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+AttributeRemoveAction", "Attribute Remove Action" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+PragmaRemoveAction", "Pragma Remove Action" }, From 6995bb980fd4da715515b8702d21c92196e1004d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 10 Jun 2022 13:15:59 -0700 Subject: [PATCH 03/28] Initial work to get asp.net doc highlights --- Roslyn.sln | 12 ++--- .../AbstractDocumentHighlightsService.cs | 49 ++++++++++--------- ...beddedLanguageDocumentHighlightsService.cs | 21 ++++++++ .../IEmbeddedLanguageFeatures.cs | 5 -- .../LanguageServices/RegexEmbeddedLanguage.cs | 9 ++-- 5 files changed, 55 insertions(+), 41 deletions(-) create mode 100644 src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs 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/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs b/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs index 64a1da145f1b8..a96f1937dd8e1 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.Project, 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/IEmbeddedLanguageDocumentHighlightsService.cs b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs new file mode 100644 index 0000000000000..2cf41dd011055 --- /dev/null +++ b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs @@ -0,0 +1,21 @@ +// 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 IEmbeddedLanguageDocumentHighlightsService : IEmbeddedLanguageFeatureService + { + ImmutableArray GetDocumentHighlights( + Project project, + SemanticModel semanticModel, + SyntaxToken token, + int position, + HighlightingOptions options, + CancellationToken cancellationToken); + } +} 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/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); From 5525284ee3c952d832c454ad6f20e8b7bcc3afde Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 10 Jun 2022 13:23:09 -0700 Subject: [PATCH 04/28] work --- ...rtEmbeddedLanguageBraceMatcherAttribute.cs | 68 +++++++++++++++++++ .../RegexDocumentHighlightsService.cs | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageBraceMatcherAttribute.cs diff --git a/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageBraceMatcherAttribute.cs b/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageBraceMatcherAttribute.cs new file mode 100644 index 0000000000000..b9e6910746162 --- /dev/null +++ b/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageBraceMatcherAttribute.cs @@ -0,0 +1,68 @@ +// 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.Collections.Immutable; +using System.Composition; +using Microsoft.CodeAnalysis.EmbeddedLanguages; + +namespace Microsoft.CodeAnalysis.DocumentHighlighting +{ + /// + /// Use this attribute to export a . + /// + [MetadataAttribute] + [AttributeUsage(AttributeTargets.Class)] + internal class ExportEmbeddedLanguageDocumentHighlightsServiceAttribute : ExportAttribute + { + /// + /// 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 ExportEmbeddedLanguageDocumentHighlightsServiceAttribute( + string name, string language, params string[] identifiers) + : base(typeof(IEmbeddedLanguageDocumentHighlightsService)) + { + 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 ExportEmbeddedLanguageDocumentHighlightsServiceInternalAttribute : ExportEmbeddedLanguageDocumentHighlightsServiceAttribute + { + /// + public bool SupportsUnannotatedAPIs { get; } + + public ExportEmbeddedLanguageDocumentHighlightsServiceInternalAttribute( + string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) + : base(name, language, identifiers) + { + SupportsUnannotatedAPIs = supportsUnannotatedAPIs; + } + } +} diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs index 00753e8bbfa32..68ef99401d086 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs @@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.L { using RegexToken = EmbeddedSyntaxToken; - internal sealed class RegexDocumentHighlightsService : IDocumentHighlightsService + internal sealed class RegexDocumentHighlightsService : IEmbeddedLanguageDocumentHighlightsService { private readonly RegexEmbeddedLanguage _language; From 5478e193990095672cc089caf6ae262264ff16ef Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 10 Jun 2022 13:41:17 -0700 Subject: [PATCH 05/28] Work --- ...IEmbeddedLanguageDocumentHighlightsService.cs | 2 +- ...=> AbstractRegexDocumentHighlightsService.cs} | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) rename src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/{RegexDocumentHighlightsService.cs => AbstractRegexDocumentHighlightsService.cs} (88%) diff --git a/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs index 2cf41dd011055..4ec9427417b6e 100644 --- a/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.DocumentHighlighting internal interface IEmbeddedLanguageDocumentHighlightsService : IEmbeddedLanguageFeatureService { ImmutableArray GetDocumentHighlights( - Project project, + Document document, SemanticModel semanticModel, SyntaxToken token, int position, diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs similarity index 88% rename from src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs rename to src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs index 68ef99401d086..2648f2a5183dd 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.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.Collections.Immutable; using System.Threading; @@ -18,22 +16,22 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.L { using RegexToken = EmbeddedSyntaxToken; - internal sealed class RegexDocumentHighlightsService : IEmbeddedLanguageDocumentHighlightsService + internal abstract class AbstractRegexDocumentHighlightsService : IEmbeddedLanguageDocumentHighlightsService { private readonly RegexEmbeddedLanguage _language; - public RegexDocumentHighlightsService(RegexEmbeddedLanguage language) + protected AbstractRegexDocumentHighlightsService(RegexEmbeddedLanguage language) => _language = language; - 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 detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, _language.Info); + var tree = detector.TryParseString(token, semanticModel, cancellationToken); + return tree == null ? default : ImmutableArray.Create(new DocumentHighlights(document, GetHighlights(tree, position))); From e88c25e66ab8d4e7d818d85396dba05959866b3e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 10 Jun 2022 14:07:12 -0700 Subject: [PATCH 06/28] Renames --- ...efinedEmbeddedLanguageBraceMatcherNames.cs | 13 --------- ...Matcher.cs => AbstractJsonBraceMatcher.cs} | 4 +-- .../CSharpDocumentHighlightsService.cs | 11 +++++++- ...eClassifier.cs => CSharpJsonClassifier.cs} | 6 ++--- ...Classifier.cs => CSharpRegexClassifier.cs} | 8 +++--- .../AbstractDocumentHighlightsService.cs | 2 +- ...lassifier.cs => AbstractJsonClassifier.cs} | 4 +-- ...assifier.cs => AbstractRegexClassifier.cs} | 4 +-- .../AbstractRegexDocumentHighlightsService.cs | 3 +-- .../VisualBasicDocumentHighlightsService.vb | 11 +++++++- ...beddedLanguageDocumentHighlightsService.vb | 27 +++++++++++++++++++ ...edefinedEmbeddedLanguageClassifierNames.cs | 4 +-- 12 files changed, 64 insertions(+), 33 deletions(-) delete mode 100644 src/EditorFeatures/Core/BraceMatching/PredefinedEmbeddedLanguageBraceMatcherNames.cs rename src/EditorFeatures/Core/EmbeddedLanguages/Json/{AbstractJsonEmbeddedLanguageBraceMatcher.cs => AbstractJsonBraceMatcher.cs} (95%) rename src/Features/CSharp/Portable/EmbeddedLanguages/{CSharpJsonEmbeddedLanguageClassifier.cs => CSharpJsonClassifier.cs} (74%) rename src/Features/CSharp/Portable/EmbeddedLanguages/{CSharpRegexEmbeddedLanguageClassifier.cs => CSharpRegexClassifier.cs} (73%) rename src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/{AbstractJsonEmbeddedLanguageClassifier.cs => AbstractJsonClassifier.cs} (97%) rename src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/{AbstractRegexEmbeddedLanguageClassifier.cs => AbstractRegexClassifier.cs} (98%) create mode 100644 src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb rename src/Workspaces/Core/Portable/{Classification => }/EmbeddedLanguages/PredefinedEmbeddedLanguageClassifierNames.cs (73%) 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/AbstractJsonBraceMatcher.cs similarity index 95% rename from src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonEmbeddedLanguageBraceMatcher.cs rename to src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonBraceMatcher.cs index 631b407a2f847..abf09b90b5673 100644 --- a/src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonEmbeddedLanguageBraceMatcher.cs +++ b/src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonBraceMatcher.cs @@ -18,11 +18,11 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json /// /// Brace matcher impl for embedded json strings. /// - internal abstract class AbstractJsonEmbeddedLanguageBraceMatcher : IEmbeddedLanguageBraceMatcher + internal abstract class AbstractJsonBraceMatcher : IEmbeddedLanguageBraceMatcher { private readonly EmbeddedLanguageInfo _info; - public AbstractJsonEmbeddedLanguageBraceMatcher(EmbeddedLanguageInfo info) + public AbstractJsonBraceMatcher(EmbeddedLanguageInfo info) => _info = info; public BraceMatchingResult? FindBraces( diff --git a/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs b/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs index 970e96da01e6a..2e120fbe7c6a7 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/CSharpJsonClassifier.cs similarity index 74% rename from src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonEmbeddedLanguageClassifier.cs rename to src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonClassifier.cs index f17b7ebf38c61..760cb2b6730e9 100644 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonEmbeddedLanguageClassifier.cs +++ b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonClassifier.cs @@ -12,12 +12,12 @@ namespace Microsoft.CodeAnalysis.CSharp.Features.EmbeddedLanguages { [ExportEmbeddedLanguageClassifierInternal( - PredefinedEmbeddedLanguageClassifierNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] - internal class CSharpJsonEmbeddedLanguageClassifier : AbstractJsonEmbeddedLanguageClassifier + PredefinedEmbeddedLanguageNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] + internal class CSharpJsonClassifier : AbstractJsonClassifier { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpJsonEmbeddedLanguageClassifier() + public CSharpJsonClassifier() : base(CSharpEmbeddedLanguagesProvider.Info) { } diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexClassifier.cs similarity index 73% rename from src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs rename to src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexClassifier.cs index 929b2af473c16..88949a3e32587 100644 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs +++ b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexClassifier.cs @@ -13,14 +13,14 @@ 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)] + [ExtensionOrder(Before = PredefinedEmbeddedLanguageNames.Json)] [ExportEmbeddedLanguageClassifierInternal( - PredefinedEmbeddedLanguageClassifierNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] - internal class CSharpRegexEmbeddedLanguageClassifier : AbstractRegexEmbeddedLanguageClassifier + PredefinedEmbeddedLanguageNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] + internal class CSharpRegexClassifier : AbstractRegexClassifier { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpRegexEmbeddedLanguageClassifier() + public CSharpRegexClassifier() : base(CSharpEmbeddedLanguagesProvider.Info) { } diff --git a/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs b/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs index a96f1937dd8e1..defccd083018c 100644 --- a/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs @@ -98,7 +98,7 @@ private ImmutableArray TryGetEmbeddedLanguageHighlights( foreach (var service in embeddedHighlightsServices) { var result = service.Value.GetDocumentHighlights( - document.Project, semanticModel, token, position, options, cancellationToken); + document, semanticModel, token, position, options, cancellationToken); if (!result.IsDefaultOrEmpty) return result; } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonEmbeddedLanguageClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonClassifier.cs similarity index 97% rename from src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonEmbeddedLanguageClassifier.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonClassifier.cs index 514a909bae8b0..5b4ff21062573 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonEmbeddedLanguageClassifier.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonClassifier.cs @@ -17,12 +17,12 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageService /// /// Classifier impl for embedded json strings. /// - internal abstract class AbstractJsonEmbeddedLanguageClassifier : IEmbeddedLanguageClassifier + internal abstract class AbstractJsonClassifier : IEmbeddedLanguageClassifier { private static readonly ObjectPool s_visitorPool = new(() => new Visitor()); private readonly EmbeddedLanguageInfo _info; - public AbstractJsonEmbeddedLanguageClassifier(EmbeddedLanguageInfo info) + public AbstractJsonClassifier(EmbeddedLanguageInfo info) { _info = info; } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexEmbeddedLanguageClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexClassifier.cs similarity index 98% rename from src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexEmbeddedLanguageClassifier.cs rename to src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexClassifier.cs index 1a66b8761ce6b..638c1632d8c6d 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexEmbeddedLanguageClassifier.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexClassifier.cs @@ -18,13 +18,13 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.L /// /// Classifier impl for embedded regex strings. /// - internal abstract class AbstractRegexEmbeddedLanguageClassifier : IEmbeddedLanguageClassifier + internal abstract class AbstractRegexClassifier : IEmbeddedLanguageClassifier { private static readonly ObjectPool s_visitorPool = SharedPools.Default(); private readonly EmbeddedLanguageInfo _info; - protected AbstractRegexEmbeddedLanguageClassifier(EmbeddedLanguageInfo info) + protected AbstractRegexClassifier(EmbeddedLanguageInfo info) { _info = info; } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs index 2648f2a5183dd..8fffc9c44627a 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Immutable; using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.DocumentHighlighting; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; @@ -113,7 +112,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/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb b/src/Features/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb index 9ba01d722e9b9..c5f744f74e3c3 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 IEmbeddedLanguageDocumentHighlightsService, EmbeddedLanguageMetadata))) + MyBase.New( + LanguageNames.VisualBasic, + VisualBasicEmbeddedLanguagesProvider.Info, + VisualBasicSyntaxKinds.Instance, + services) End Sub End Class End Namespace diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb new file mode 100644 index 0000000000000..291e30a5f1ea6 --- /dev/null +++ b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb @@ -0,0 +1,27 @@ +' 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.DocumentHighlighting +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 VisualBasicRegexEmbeddedLanguageDocumentHighlightsService + Inherits AbstractRegexEmbeddedLanguageDocumentHighlightsService + + + + Public Sub New() + MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) + End Sub + End Class +End Namespace 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); From 1c7fb014bd2e327a00fbc3bb17bad16d30600de2 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 10 Jun 2022 14:14:20 -0700 Subject: [PATCH 07/28] Add regex highlighters --- ...ngService.cs => CSharpJsonBraceMatcher.cs} | 7 +++-- ...eMatcher.cs => CSharpRegexBraceMatcher.cs} | 7 +++-- ...atcher.cs => AbstractRegexBraceMatcher.cs} | 4 +-- ...cher.vb => VisualBasicJsonBraceMatcher.vb} | 6 ++--- ...her.vb => VisualBasicRegexBraceMatcher.vb} | 6 ++--- .../CSharpRegexDocumentHighlightsService.cs | 26 +++++++++++++++++++ .../AbstractRegexDocumentHighlightsService.cs | 9 ++++--- ...sifier.vb => VisualBasicJsonClassifier.vb} | 6 ++--- ...ifier.vb => VisualBasicRegexClassifier.vb} | 8 +++--- ...beddedLanguageDocumentHighlightsService.vb | 4 +-- 10 files changed, 54 insertions(+), 29 deletions(-) rename src/EditorFeatures/CSharp/EmbeddedLanguages/{CSharpJsonEmbeddedLanguageBraceMatchingService.cs => CSharpJsonBraceMatcher.cs} (71%) rename src/EditorFeatures/CSharp/EmbeddedLanguages/{CSharpRegexEmbeddedLanguageBraceMatcher.cs => CSharpRegexBraceMatcher.cs} (71%) rename src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/{AbstractRegexEmbeddedLanguageBraceMatcher.cs => AbstractRegexBraceMatcher.cs} (96%) rename src/EditorFeatures/VisualBasic/EmbeddedLanguages/{VisualBasicJsonEmbeddedLanguageBraceMatcher.vb => VisualBasicJsonBraceMatcher.vb} (77%) rename src/EditorFeatures/VisualBasic/EmbeddedLanguages/{VisualBasicRegexEmbeddedLanguageBraceMatcher.vb => VisualBasicRegexBraceMatcher.vb} (77%) create mode 100644 src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlightsService.cs rename src/Features/VisualBasic/Portable/EmbeddedLanguages/{VisualBasicJsonEmbeddedLanguageClassifier.vb => VisualBasicJsonClassifier.vb} (78%) rename src/Features/VisualBasic/Portable/EmbeddedLanguages/{VisualBasicRegexEmbeddedLanguageClassifier.vb => VisualBasicRegexClassifier.vb} (76%) diff --git a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonBraceMatcher.cs similarity index 71% rename from src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs rename to src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonBraceMatcher.cs index b072df403dae2..cbbe4d6d36f61 100644 --- a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs +++ b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonBraceMatcher.cs @@ -12,13 +12,12 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.EmbeddedLanguages { [ExportEmbeddedLanguageBraceMatcherInternal( - PredefinedEmbeddedLanguageBraceMatcherNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] - internal sealed class CSharpJsonEmbeddedLanguageBraceMatcher : - AbstractJsonEmbeddedLanguageBraceMatcher + PredefinedEmbeddedLanguageNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] + internal sealed class CSharpJsonBraceMatcher : AbstractJsonBraceMatcher { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpJsonEmbeddedLanguageBraceMatcher() + public CSharpJsonBraceMatcher() : base(CSharpEmbeddedLanguagesProvider.Info) { } diff --git a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexBraceMatcher.cs similarity index 71% rename from src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs rename to src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexBraceMatcher.cs index 500a8c69f9229..ad99a32648864 100644 --- a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs +++ b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexBraceMatcher.cs @@ -12,13 +12,12 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.EmbeddedLanguages { [ExportEmbeddedLanguageBraceMatcherInternal( - PredefinedEmbeddedLanguageBraceMatcherNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] - internal sealed class CSharpRegexEmbeddedLanguageBraceMatcher : - AbstractRegexEmbeddedLanguageBraceMatcher + PredefinedEmbeddedLanguageNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] + internal sealed class CSharpRegexBraceMatcher : AbstractRegexBraceMatcher { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpRegexEmbeddedLanguageBraceMatcher() + public CSharpRegexBraceMatcher() : base(CSharpEmbeddedLanguagesProvider.Info) { } diff --git a/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexEmbeddedLanguageBraceMatcher.cs b/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexBraceMatcher.cs similarity index 96% rename from src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexEmbeddedLanguageBraceMatcher.cs rename to src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexBraceMatcher.cs index 0a84d0168c2ab..9d9950a12a127 100644 --- a/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexEmbeddedLanguageBraceMatcher.cs +++ b/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexBraceMatcher.cs @@ -19,11 +19,11 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions /// /// Brace matching impl for embedded regex strings. /// - internal abstract class AbstractRegexEmbeddedLanguageBraceMatcher : IEmbeddedLanguageBraceMatcher + internal abstract class AbstractRegexBraceMatcher : IEmbeddedLanguageBraceMatcher { private readonly EmbeddedLanguageInfo _info; - protected AbstractRegexEmbeddedLanguageBraceMatcher(EmbeddedLanguageInfo info) + protected AbstractRegexBraceMatcher(EmbeddedLanguageInfo info) => _info = info; public BraceMatchingResult? FindBraces( diff --git a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonBraceMatcher.vb similarity index 77% rename from src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb rename to src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonBraceMatcher.vb index a1ded57111aeb..0f7aeb79f5959 100644 --- a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb +++ b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonBraceMatcher.vb @@ -10,9 +10,9 @@ Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EmbeddedLanguages - Friend Class VisualBasicJsonEmbeddedLanguageBraceMatcher - Inherits AbstractJsonEmbeddedLanguageBraceMatcher + PredefinedEmbeddedLanguageNames.Json, LanguageNames.VisualBasic, True, "Json"), [Shared]> + Friend Class VisualBasicJsonBraceMatcher + Inherits AbstractJsonBraceMatcher diff --git a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexBraceMatcher.vb similarity index 77% rename from src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb rename to src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexBraceMatcher.vb index 577db240cb023..ee1c2a5cfad19 100644 --- a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb +++ b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexBraceMatcher.vb @@ -10,9 +10,9 @@ Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EmbeddedLanguages - Friend Class VisualBasicRegexEmbeddedLanguageBraceMatcher - Inherits AbstractRegexEmbeddedLanguageBraceMatcher + PredefinedEmbeddedLanguageNames.Regex, LanguageNames.VisualBasic, True, "Regex", "Regexp"), [Shared]> + Friend Class VisualBasicRegexBraceMatcher + Inherits AbstractRegexBraceMatcher diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlightsService.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlightsService.cs new file mode 100644 index 0000000000000..7bf7e38c0d96f --- /dev/null +++ b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlightsService.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 System; +using System.Composition; +using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.LanguageServices; +using Microsoft.CodeAnalysis.DocumentHighlighting; +using Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.LanguageServices; +using Microsoft.CodeAnalysis.Host.Mef; + +namespace Microsoft.CodeAnalysis.CSharp.Features.EmbeddedLanguages +{ + [ExtensionOrder(Before = PredefinedEmbeddedLanguageNames.Json)] + [ExportEmbeddedLanguageDocumentHighlightsServiceInternal( + PredefinedEmbeddedLanguageNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] + internal class CSharpRegexDocumentHighlightsService : AbstractRegexDocumentHighlightsService + { + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public CSharpRegexDocumentHighlightsService() + : base(CSharpEmbeddedLanguagesProvider.Info) + { + } + } +} diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs index 8fffc9c44627a..2b4871998e2ee 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs @@ -6,6 +6,7 @@ using System.Collections.Immutable; using System.Threading; using Microsoft.CodeAnalysis.DocumentHighlighting; +using Microsoft.CodeAnalysis.EmbeddedLanguages; using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; @@ -17,10 +18,10 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.L internal abstract class AbstractRegexDocumentHighlightsService : IEmbeddedLanguageDocumentHighlightsService { - private readonly RegexEmbeddedLanguage _language; + private readonly EmbeddedLanguageInfo _info; - protected AbstractRegexDocumentHighlightsService(RegexEmbeddedLanguage language) - => _language = language; + protected AbstractRegexDocumentHighlightsService(EmbeddedLanguageInfo info) + => _info = info; public ImmutableArray GetDocumentHighlights( Document document, SemanticModel semanticModel, SyntaxToken token, int position, HighlightingOptions options, CancellationToken cancellationToken) @@ -28,7 +29,7 @@ public ImmutableArray GetDocumentHighlights( if (!options.HighlightRelatedRegexComponentsUnderCursor) return default; - var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, _language.Info); + var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, _info); var tree = detector.TryParseString(token, semanticModel, cancellationToken); return tree == null diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonClassifier.vb similarity index 78% rename from src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb rename to src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonClassifier.vb index 88566a89e9ccb..c298f9be75cc5 100644 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb +++ b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonClassifier.vb @@ -10,9 +10,9 @@ Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices Namespace Microsoft.CodeAnalysis.VisualBasic.Features.EmbeddedLanguages - Friend Class VisualBasicJsonEmbeddedLanguageClassifier - Inherits AbstractJsonEmbeddedLanguageClassifier + PredefinedEmbeddedLanguageNames.Json, LanguageNames.VisualBasic, True, "Json"), [Shared]> + Friend Class VisualBasicJsonClassifier + Inherits AbstractJsonClassifier diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexClassifier.vb similarity index 76% rename from src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb rename to src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexClassifier.vb index 847389b65f68e..1c0c51265f29d 100644 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb +++ b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexClassifier.vb @@ -11,11 +11,11 @@ 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 + PredefinedEmbeddedLanguageNames.Regex, LanguageNames.VisualBasic, True, "Regex", "Regexp"), [Shared]> + Friend Class VisualBasicRegexClassifier + Inherits AbstractRegexClassifier diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb index 291e30a5f1ea6..3cb33d71ab2b2 100644 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb +++ b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb @@ -15,8 +15,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Features.EmbeddedLanguages - Friend Class VisualBasicRegexEmbeddedLanguageDocumentHighlightsService - Inherits AbstractRegexEmbeddedLanguageDocumentHighlightsService + Friend Class VisualBasicRegexDocumentHighlightsService + Inherits AbstractRegexDocumentHighlightsService From 332e27b67d0475e4754d702184850f923e86e16f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 10 Jun 2022 14:19:20 -0700 Subject: [PATCH 08/28] Add docs --- .../IEmbeddedLanguageDocumentHighlightsService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs index 4ec9427417b6e..008230d99bebd 100644 --- a/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs @@ -8,8 +8,10 @@ namespace Microsoft.CodeAnalysis.DocumentHighlighting { + /// internal interface IEmbeddedLanguageDocumentHighlightsService : IEmbeddedLanguageFeatureService { + /// ImmutableArray GetDocumentHighlights( Document document, SemanticModel semanticModel, From de06f0543f39386206e447367f84e08e5386bceb Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 10 Jun 2022 17:02:55 -0700 Subject: [PATCH 09/28] Use the complete branch name in DartLab yml --- azure-pipelines-integration-dartlab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 23972231641ca30e710b3c00e9486f3f2ecdb451 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 10 Jun 2022 17:46:41 -0700 Subject: [PATCH 10/28] Generate better descriptions for code actions from nested classes. --- .../BuildActionTelemetryTable/Program.cs | 77 +++++++++++++------ 1 file changed, 52 insertions(+), 25 deletions(-) diff --git a/src/Tools/BuildActionTelemetryTable/Program.cs b/src/Tools/BuildActionTelemetryTable/Program.cs index eac0c5925a16f..555c3372117c1 100644 --- a/src/Tools/BuildActionTelemetryTable/Program.cs +++ b/src/Tools/BuildActionTelemetryTable/Program.cs @@ -32,6 +32,7 @@ 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() @@ -440,9 +441,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} ..."); @@ -552,15 +553,17 @@ internal static string GenerateCodeActionsDescriptionMap(ImmutableArray Date: Fri, 10 Jun 2022 18:21:38 -0700 Subject: [PATCH 11/28] Fix up TFM --- .../BuildActionTelemetryTable.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 @@ - + From c4bb7a445e0c468de5e3de75ee2adebe820d4b84 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 10 Jun 2022 18:44:16 -0700 Subject: [PATCH 12/28] Ensure Refactorings are named differently than Fixes --- .../BuildActionTelemetryTable/Program.cs | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/src/Tools/BuildActionTelemetryTable/Program.cs b/src/Tools/BuildActionTelemetryTable/Program.cs index 555c3372117c1..0d70dfb0107da 100644 --- a/src/Tools/BuildActionTelemetryTable/Program.cs +++ b/src/Tools/BuildActionTelemetryTable/Program.cs @@ -562,8 +562,21 @@ internal static string GenerateCodeActionsDescriptionMap(ImmutableArray Date: Fri, 10 Jun 2022 18:51:53 -0700 Subject: [PATCH 13/28] Update Action description table --- .../BuildActionTelemetryTable/Program.cs | 312 +++++++++--------- 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/src/Tools/BuildActionTelemetryTable/Program.cs b/src/Tools/BuildActionTelemetryTable/Program.cs index 0d70dfb0107da..2be4383fbe7ec 100644 --- a/src/Tools/BuildActionTelemetryTable/Program.cs +++ b/src/Tools/BuildActionTelemetryTable/Program.cs @@ -97,98 +97,98 @@ public class Program { "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" }, + { "Microsoft.CodeAnalysis.CSharp.Wrapping.CSharpWrappingCodeRefactoringProvider", "Wrapping (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckWithoutNameCodeFixProvider", "Is And Cast Check Without Name" }, { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpUseNotPatternCodeFixProvider", "Use Not Pattern" }, { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpAsAndNullCheckCodeFixProvider", "As And Null Check" }, { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckCodeFixProvider", "Is And Cast Check" }, - { "Microsoft.CodeAnalysis.CSharp.UseNamedArguments.CSharpUseNamedArgumentsCodeRefactoringProvider", "Use Named Arguments" }, + { "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" }, + { "Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyCodeRefactoringProvider", "Use Expression Body (Refactoring)" }, { "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" }, + { "Microsoft.CodeAnalysis.CSharp.UseExpressionBodyForLambda.UseExpressionBodyForLambdaCodeRefactoringProvider", "Use Expression Body For Lambda (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.UseExplicitTypeForConst.UseExplicitTypeForConstCodeFixProvider", "Use Explicit Type For Const" }, { "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", "Merge Consecutive If Statements" }, - { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements" }, - { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements" }, - { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Into Nested If Statements" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpMergeConsecutiveIfStatementsCodeRefactoringProvider", "Merge Consecutive If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoNestedIfStatementsCodeRefactoringProvider", "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" }, - { "Microsoft.CodeAnalysis.CSharp.ReplaceDocCommentTextWithTag.CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider", "Replace Doc Comment Text With Tag" }, + { "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" }, + { "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" }, - { "Microsoft.CodeAnalysis.CSharp.MoveDeclarationNearReference.CSharpMoveDeclarationNearReferenceCodeRefactoringProvider", "Move Declaration Near Reference" }, + { "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.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" }, + { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticCodeRefactoringProvider", "Make Local Function Static (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.PassInCapturedVariablesAsArgumentsCodeFixProvider", "Pass In Captured Variables As Arguments" }, - { "Microsoft.CodeAnalysis.CSharp.InvertLogical.CSharpInvertLogicalCodeRefactoringProvider", "Invert Logical" }, - { "Microsoft.CodeAnalysis.CSharp.InvertIf.CSharpInvertIfCodeRefactoringProvider", "Invert If" }, - { "Microsoft.CodeAnalysis.CSharp.InvertConditional.CSharpInvertConditionalCodeRefactoringProvider", "Invert Conditional" }, - { "Microsoft.CodeAnalysis.CSharp.IntroduceVariable.CSharpIntroduceLocalForExpressionCodeRefactoringProvider", "Introduce Local For Expression" }, - { "Microsoft.CodeAnalysis.CSharp.IntroduceVariable.CSharpIntroduceParameterCodeRefactoringProvider", "Introduce Parameter" }, - { "Microsoft.CodeAnalysis.CSharp.IntroduceUsingStatement.CSharpIntroduceUsingStatementCodeRefactoringProvider", "Introduce Using Statement" }, - { "Microsoft.CodeAnalysis.CSharp.InitializeParameter.CSharpAddParameterCheckCodeRefactoringProvider", "Add Parameter Check" }, - { "Microsoft.CodeAnalysis.CSharp.InitializeParameter.CSharpInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Member From Parameter" }, - { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementExplicitlyCodeRefactoringProvider", "Implement Explicitly" }, - { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementImplicitlyCodeRefactoringProvider", "Implement Implicitly" }, + { "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 Local For Expression (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.IntroduceVariable.CSharpIntroduceParameterCodeRefactoringProvider", "Introduce Parameter (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.IntroduceUsingStatement.CSharpIntroduceUsingStatementCodeRefactoringProvider", "Introduce Using Statement (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.InitializeParameter.CSharpAddParameterCheckCodeRefactoringProvider", "Add Parameter Check (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.InitializeParameter.CSharpInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Member From Parameter (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementExplicitlyCodeRefactoringProvider", "Implement Explicitly (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementImplicitlyCodeRefactoringProvider", "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" }, + { "Microsoft.CodeAnalysis.CSharp.GenerateConstructorFromMembers.CSharpGenerateConstructorFromMembersCodeRefactoringProvider", "Generate Constructor From Members (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.CSharpJsonDetectionCodeFixProvider", "Json Detection" }, { "Microsoft.CodeAnalysis.CSharp.Diagnostics.AddBraces.CSharpAddBracesCodeFixProvider", "Add Braces" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertTupleToStruct.CSharpConvertTupleToStructCodeRefactoringProvider", "Convert Tuple To Struct" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertToRawString.ConvertRegularStringToRawStringCodeRefactoringProvider", "Convert Regular String To Raw String" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertConcatenationToInterpolatedStringRefactoringProvider", "Convert Concatenation To Interpolated String" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert Placeholder To Interpolated String" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertTupleToStruct.CSharpConvertTupleToStructCodeRefactoringProvider", "Convert Tuple To Struct (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToRawString.ConvertRegularStringToRawStringCodeRefactoringProvider", "Convert Regular String To Raw String (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertConcatenationToInterpolatedStringRefactoringProvider", "Convert Concatenation To Interpolated String (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert Placeholder To Interpolated String (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeFixProvider", "Convert To Program Main" }, { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeRefactoringProvider", "Convert To Program Main (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeFixProvider", "Convert To Top Level Statements" }, { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeRefactoringProvider", "Convert To Top Level Statements (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertNumericLiteral.CSharpConvertNumericLiteralCodeRefactoringProvider", "Convert Numeric Literal" }, + { "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 Provider" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertLinq.ConvertForEachToLinqQuery.CSharpConvertForEachToLinqQueryProvider", "Convert For Each To Linq Query Provider" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertIfToSwitch.CSharpConvertIfToSwitchCodeRefactoringProvider", "Convert If To Switch" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertForToForEach.CSharpConvertForToForEachCodeRefactoringProvider", "Convert For To For Each" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertForEachToFor.CSharpConvertForEachToForCodeRefactoringProvider", "Convert For Each To For" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertCast.CSharpConvertDirectCastToTryCastCodeRefactoringProvider", "Convert Direct Cast To Try Cast" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertCast.CSharpConvertTryCastToDirectCastCodeRefactoringProvider", "Convert Try Cast To Direct Cast" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.ConvertBetweenRegularAndVerbatimInterpolatedStringCodeRefactoringProvider", "Convert Between Regular And Verbatim Interpolated String" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.ConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider", "Convert Between Regular And Verbatim String" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertAutoPropertyToFullProperty.CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider", "Convert Auto Property To Full Property" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousType.CSharpConvertAnonymousTypeToClassCodeRefactoringProvider", "Convert Anonymous Type To Class" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousType.CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider", "Convert Anonymous Type To Tuple" }, + { "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 Direct Cast To Try Cast (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertCast.CSharpConvertTryCastToDirectCastCodeRefactoringProvider", "Convert Try Cast To Direct Cast (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.ConvertBetweenRegularAndVerbatimInterpolatedStringCodeRefactoringProvider", "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", "Resolve Conflict Marker" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseRecursivePatterns.UseRecursivePatternsCodeRefactoringProvider", "Use Recursive Patterns" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseImplicitType.UseImplicitTypeCodeRefactoringProvider", "Use Implicit Type" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseExplicitType.UseExplicitTypeCodeRefactoringProvider", "Use Explicit Type" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.SyncNamespace.CSharpSyncNamespaceCodeRefactoringProvider", "Sync Namespace" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.PullMemberUp.CSharpPullMemberUpCodeRefactoringProvider", "Pull Member Up" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.MoveStaticMembers.CSharpMoveStaticMembersRefactoringProvider", "Move Static Members" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineTemporary.CSharpInlineTemporaryCodeRefactoringProvider", "Inline Temporary" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineMethod.CSharpInlineMethodRefactoringProvider", "Inline Method" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ExtractClass.CSharpExtractClassCodeRefactoringProvider", "Extract Class" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider", "Enable Nullable" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ConvertLocalFunctionToMethod.CSharpConvertLocalFunctionToMethodCodeRefactoringProvider", "Convert Local Function To Method" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.AddMissingImports.CSharpAddMissingImportsRefactoringProvider", "Add Missing Imports" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.AddAwait.CSharpAddAwaitCodeRefactoringProvider", "Add Await" }, + { "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", "Change Namespace To Match Folder" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.FixIncorrectConstraint.CSharpFixIncorrectConstraintCodeFixProvider", "Fix Incorrect Constraint" }, @@ -217,11 +217,11 @@ public class Program { "Microsoft.CodeAnalysis.CSharp.AddPackage.CSharpAddSpecificPackageCodeFixProvider", "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" }, - { "Microsoft.CodeAnalysis.CSharp.AddDebuggerDisplay.CSharpAddDebuggerDisplayCodeRefactoringProvider", "Add Debugger Display" }, + { "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" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.HideBase.HideBaseCodeFixProvider+AddNewKeywordAction", "Add New Keyword Action" }, + { "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" }, @@ -237,26 +237,26 @@ public class Program { "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.Wrapping.WrapItemsAction", "Wrap Items Action" }, - { "Microsoft.CodeAnalysis.UpgradeProject.ProjectOptionsChangeAction", "Project Options Change Action" }, - { "Microsoft.CodeAnalysis.ReplacePropertyWithMethods.ReplacePropertyWithMethodsCodeRefactoringProvider", "Replace Property With Methods" }, - { "Microsoft.CodeAnalysis.ReplaceMethodWithProperty.ReplaceMethodWithPropertyCodeRefactoringProvider", "Replace Method With Property" }, + { "Microsoft.CodeAnalysis.Wrapping.WrapItemsAction", "Wrap Items" }, + { "Microsoft.CodeAnalysis.UpgradeProject.ProjectOptionsChangeAction", "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" }, - { "Microsoft.CodeAnalysis.GenerateOverrides.GenerateOverridesCodeRefactoringProvider", "Generate Overrides" }, - { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider", "Generate Equals And Get Hash Code From Members" }, - { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.GenerateDefaultConstructorsCodeRefactoringProvider", "Generate Default Constructors" }, - { "Microsoft.CodeAnalysis.GenerateComparisonOperators.GenerateComparisonOperatorsCodeRefactoringProvider", "Generate Comparison Operators" }, + { "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" }, - { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.ConvertRegularStringToInterpolatedStringRefactoringProvider", "Convert Regular String To Interpolated String" }, + { "Microsoft.CodeAnalysis.EncapsulateField.EncapsulateFieldRefactoringProvider", "Encapsulate Field (Refactoring)" }, + { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.ConvertRegularStringToInterpolatedStringRefactoringProvider", "Convert Regular String To Interpolated String (Refactoring)" }, { "Microsoft.CodeAnalysis.CodeRefactorings.FixAllCodeRefactoringCodeAction", "Fix All Code Refactoring" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.MoveType.MoveTypeCodeRefactoringProvider", "Move Type" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.ExtractMethodCodeRefactoringProvider", "Extract Method" }, + { "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 Style" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.TopLevelSuppressionCodeAction", "Top Level Suppression" }, @@ -267,55 +267,54 @@ public class Program { "Microsoft.CodeAnalysis.AddPackage.InstallPackageParentCodeAction", "Install Package Parent" }, { "Microsoft.CodeAnalysis.AddPackage.InstallWithPackageManagerCodeAction", "Install With Package Manager" }, { "Microsoft.CodeAnalysis.AddMissingReference.AddMissingReferenceCodeAction", "Add Missing Reference" }, - { "Microsoft.CodeAnalysis.AddConstructorParametersFromMembers.AddConstructorParametersFromMembersCodeRefactoringProvider", "Add Constructor Parameters From Members" }, + { "Microsoft.CodeAnalysis.AddConstructorParametersFromMembers.AddConstructorParametersFromMembersCodeRefactoringProvider", "Add Constructor Parameters From Members (Refactoring)" }, { "Microsoft.CodeAnalysis.UseAutoProperty.AbstractUseAutoPropertyCodeFixProvider`5+UseAutoPropertyCodeAction", "Use Auto Property" }, - { "Microsoft.CodeAnalysis.MoveToNamespace.AbstractMoveToNamespaceCodeAction+MoveItemsToNamespaceCodeAction", "Move Items To Namespace" }, - { "Microsoft.CodeAnalysis.MoveToNamespace.AbstractMoveToNamespaceCodeAction+MoveTypeToNamespaceCodeAction", "Move Type To Namespace" }, + { "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.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.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.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+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.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeAction", "Generate Equals And Get Hash" }, - { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeWithDialogCodeAction", "Generate Equals And Get Hash Code With Dialog" }, - { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+GenerateDefaultConstructorCodeAction", "Generate Default Constructor" }, - { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+CodeActionAll", "Generate Default Constructor (All)" }, - { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+ConstructorDelegatingCodeAction", "Generate Constructor (Constructor Delegating)" }, - { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+FieldDelegatingCodeAction", "Generate Constructor (Field Delegating)" }, - { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+GenerateConstructorWithDialogCodeAction", "Generate Constructor With Dialog" }, - { "Microsoft.CodeAnalysis.CodeStyle.AbstractCodeStyleProvider`2+CodeRefactoringProvider", "" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.PullMemberUp.AbstractPullMemberUpRefactoringProvider+PullMemberUpWithDialogCodeAction", "Pull Member Up With Dialog" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.SyncNamespace.AbstractSyncNamespaceCodeRefactoringProvider`3+MoveFileCodeAction", "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.CodeFixes.NamingStyles.NamingStyleCodeFixProvider+FixNameCodeAction", "Fix Name" }, - { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider+GroupingCodeAction", "Fully Qualify (Grouping)" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageCodeAction", "Global Suppress Message" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction", "Global Suppress Message Fix All" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+LocalSuppressMessageCodeAction", "Local Suppress Message" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+PragmaWarningCodeAction", "Pragma Warning" }, - { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelBulkConfigureSeverityCodeAction", "Top Level Bulk Configure Severity" }, - { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelConfigureSeverityCodeAction", "Top Level Configure Severity" }, - { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureCodeStyle.ConfigureCodeStyleOptionCodeFixProvider+TopLevelConfigureCodeStyleOptionCodeAction", "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" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction+GlobalSuppressionSolutionChangeAction", "Global Suppression Solution Change Action" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+AttributeRemoveAction", "Attribute Remove Action" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+PragmaRemoveAction", "Pragma Remove Action" }, + { "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 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" }, - { "Microsoft.CodeAnalysis.VisualBasic.AddFileBanner.VisualBasicAddFileBannerCodeRefactoringProvider", "Add File Banner" }, + { "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 Specific Package" }, { "Microsoft.CodeAnalysis.VisualBasic.AddParameter.VisualBasicAddParameterCodeFixProvider", "Add Parameter" }, @@ -336,59 +335,59 @@ public class Program { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.AddExplicitCast.VisualBasicAddExplicitCastCodeFixProvider", "Add Explicit Cast" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicChangeToYieldCodeFixProvider", "Change To Yield" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicConvertToIteratorCodeFixProvider", "Convert To Iterator" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.AddAwait.VisualBasicAddAwaitCodeRefactoringProvider", "Add Await" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineMethodRefactoringProvider", "Inline Method" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineTemporaryCodeRefactoringProvider", "Inline Temporary" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.MoveStaticMembers.VisualBasicMoveStaticMembersRefactoringProvider", "Move Static Members" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.AddAwait.VisualBasicAddAwaitCodeRefactoringProvider", "Add Await (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineMethodRefactoringProvider", "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", "Remove Statement" }, { "Microsoft.CodeAnalysis.VisualBasic.ConflictMarkerResolution.VisualBasicResolveConflictMarkerCodeFixProvider", "Resolve Conflict Marker" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertAnonymousType.VisualBasicConvertAnonymousTypeToClassCodeRefactoringProvider", "Convert Anonymous Type To Class" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertAnonymousTypeToTuple.VisualBasicConvertAnonymousTypeToTupleCodeRefactoringProvider", "Convert Anonymous Type To Tuple" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertAutoPropertyToFullProperty.VisualBasicConvertAutoPropertyToFullPropertyCodeRefactoringProvider", "Convert Auto Property To Full Property" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertCast.VisualBasicConvertDirectCastToTryCastCodeRefactoringProvider", "Convert Direct Cast To Try Cast" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertConversionOperators.VisualBasicConvertTryCastToDirectCastCodeRefactoringProvider", "Convert Try Cast To Direct Cast" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertForEachToFor.VisualBasicConvertForEachToForCodeRefactoringProvider", "Convert For Each To For" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertForToForEach.VisualBasicConvertForToForEachCodeRefactoringProvider", "Convert For To For Each" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertIfToSwitch.VisualBasicConvertIfToSwitchCodeRefactoringProvider", "Convert If To Switch" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertNumericLiteral.VisualBasicConvertNumericLiteralCodeRefactoringProvider", "Convert Numeric Literal" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString.VisualBasicConvertConcatenationToInterpolatedStringRefactoringProvider", "Convert Concatenation To Interpolated String" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString.VisualBasicConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert Placeholder To Interpolated String" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertTupleToStruct.VisualBasicConvertTupleToStructCodeRefactoringProvider", "Convert Tuple To Struct" }, + { "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 Direct Cast To Try Cast (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertConversionOperators.VisualBasicConvertTryCastToDirectCastCodeRefactoringProvider", "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 Concatenation To Interpolated String (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString.VisualBasicConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert Placeholder To Interpolated String (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.ConvertTupleToStruct.VisualBasicConvertTupleToStructCodeRefactoringProvider", "Convert Tuple To Struct (Refactoring)" }, { "Microsoft.CodeAnalysis.VisualBasic.Features.EmbeddedLanguages.VisualBasicJsonDetectionCodeFixProvider", "Json Detection" }, - { "Microsoft.CodeAnalysis.VisualBasic.GenerateConstructorFromMembers.VisualBasicGenerateConstructorFromMembersCodeRefactoringProvider", "Generate Constructor From Members" }, + { "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", "Add Parameter Check" }, - { "Microsoft.CodeAnalysis.VisualBasic.InitializeParameter.VisualBasicInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Member From Parameter" }, - { "Microsoft.CodeAnalysis.VisualBasic.IntroduceUsingStatement.VisualBasicIntroduceUsingStatementCodeRefactoringProvider", "Introduce Using Statement" }, - { "Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable.VisualBasicIntroduceLocalForExpressionCodeRefactoringProvider", "Introduce Local For Expression" }, - { "Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable.VisualBasicIntroduceParameterCodeRefactoringProvider", "Introduce Parameter" }, - { "Microsoft.CodeAnalysis.VisualBasic.InvertConditional.VisualBasicInvertConditionalCodeRefactoringProvider", "Invert Conditional" }, - { "Microsoft.CodeAnalysis.VisualBasic.InvertIf.VisualBasicInvertMultiLineIfCodeRefactoringProvider", "Invert Multi Line If" }, - { "Microsoft.CodeAnalysis.VisualBasic.InvertIf.VisualBasicInvertSingleLineIfCodeRefactoringProvider", "Invert Single Line If" }, - { "Microsoft.CodeAnalysis.VisualBasic.InvertLogical.VisualBasicInvertLogicalCodeRefactoringProvider", "Invert Logical" }, + { "Microsoft.CodeAnalysis.VisualBasic.InitializeParameter.VisualBasicAddParameterCheckCodeRefactoringProvider", "Add Parameter Check (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.InitializeParameter.VisualBasicInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Member From Parameter (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.IntroduceUsingStatement.VisualBasicIntroduceUsingStatementCodeRefactoringProvider", "Introduce Using Statement (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable.VisualBasicIntroduceLocalForExpressionCodeRefactoringProvider", "Introduce Local For Expression (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable.VisualBasicIntroduceParameterCodeRefactoringProvider", "Introduce Parameter (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertConditional.VisualBasicInvertConditionalCodeRefactoringProvider", "Invert Conditional (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertIf.VisualBasicInvertMultiLineIfCodeRefactoringProvider", "Invert Multi Line If (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.InvertIf.VisualBasicInvertSingleLineIfCodeRefactoringProvider", "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" }, - { "Microsoft.CodeAnalysis.VisualBasic.NameTupleElement.VisualBasicNameTupleElementCodeRefactoringProvider", "Name Tuple Element" }, + { "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" }, - { "Microsoft.CodeAnalysis.VisualBasic.ReplaceDocCommentTextWithTag.VisualBasicReplaceDocCommentTextWithTagCodeRefactoringProvider", "Replace Doc Comment Text With Tag" }, + { "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", "Merge Consecutive If Statements" }, - { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements" }, - { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements" }, - { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Into Nested If Statements" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicMergeConsecutiveIfStatementsCodeRefactoringProvider", "Merge Consecutive If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements (Refactoring)" }, + { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Into Nested If Statements (Refactoring)" }, { "Microsoft.CodeAnalysis.VisualBasic.UseAutoProperty.VisualBasicUseAutoPropertyCodeFixProvider", "Use Auto Property" }, - { "Microsoft.CodeAnalysis.VisualBasic.UseNamedArguments.VisualBasicUseNamedArgumentsCodeRefactoringProvider", "Use Named Arguments" }, - { "Microsoft.CodeAnalysis.VisualBasic.Wrapping.VisualBasicWrappingCodeRefactoringProvider", "Wrapping" }, + { "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 Get Type To Name Of" }, { "Microsoft.CodeAnalysis.VisualBasic.FileHeaders.VisualBasicFileHeaderCodeFixProvider", "File Header" }, @@ -420,15 +419,15 @@ public class Program { "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" }, + { "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", "Add Keyword" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+ReplaceKeywordCodeAction", "Replace Keyword" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+ReplaceTokenKeywordCodeAction", "Replace Token Keyword" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.MoveToTopOfFile.MoveToTopOfFileCodeFixProvider+MoveToLineCodeAction", "Move To Line" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.OverloadBase.OverloadBaseCodeFixProvider+AddKeywordAction", "Add Keyword Action" }, - { "Microsoft.CodeAnalysis.CodeFixesAndRefactorings.DocumentBasedFixAllProviderHelpers+PostProcessCodeAction", "Post Process" }, + { "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.MoveToTopOfFile.MoveToTopOfFileCodeFixProvider+MoveToLineCodeAction", "Move To Top Of File: Move To Line" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.OverloadBase.OverloadBaseCodeFixProvider+AddKeywordAction", "Overload Base: Add Keyword" }, + { "Microsoft.CodeAnalysis.CodeFixesAndRefactorings.DocumentBasedFixAllProviderHelpers+PostProcessCodeAction", "Document Based Fix All: Post Process" }, }.ToImmutableDictionary(); public static void Main(string[] args) @@ -575,7 +574,8 @@ internal static string GenerateCodeActionsDescriptionMap(ImmutableArray Date: Fri, 10 Jun 2022 19:04:11 -0700 Subject: [PATCH 14/28] Use last namespace name when not a nested class. --- .../BuildActionTelemetryTable/Program.cs | 215 +++++++++--------- 1 file changed, 112 insertions(+), 103 deletions(-) diff --git a/src/Tools/BuildActionTelemetryTable/Program.cs b/src/Tools/BuildActionTelemetryTable/Program.cs index 2be4383fbe7ec..b9cf430ad0941 100644 --- a/src/Tools/BuildActionTelemetryTable/Program.cs +++ b/src/Tools/BuildActionTelemetryTable/Program.cs @@ -56,37 +56,37 @@ public class Program { "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 Null Check Over Type Check" }, + { "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 Operator" }, - { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseRangeOperatorCodeFixProvider", "Use Range Operator" }, + { "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 Values" }, + { "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.UseConditionalExpression.CSharpUseConditionalExpressionForAssignmentCodeFixProvider", "Use Conditional Expression For Assignment" }, - { "Microsoft.CodeAnalysis.CSharp.UseConditionalExpression.CSharpUseConditionalExpressionForReturnCodeFixProvider", "Use Conditional Expression For Return" }, + { "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 Coalesce 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.PopulateSwitch.CSharpPopulateSwitchExpressionCodeFixProvider", "Populate Switch Expression" }, - { "Microsoft.CodeAnalysis.CSharp.PopulateSwitch.CSharpPopulateSwitchStatementCodeFixProvider", "Populate Switch Statement" }, + { "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 Header" }, + { "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 Suppression" }, { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryParentheses.CSharpRemoveUnnecessaryParenthesesCodeFixProvider", "Remove Unnecessary Parentheses" }, @@ -98,10 +98,10 @@ public class Program { "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", "Is And Cast Check Without Name" }, - { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpUseNotPatternCodeFixProvider", "Use Not Pattern" }, - { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpAsAndNullCheckCodeFixProvider", "As And Null Check" }, - { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckCodeFixProvider", "Is And Cast Check" }, + { "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.UseNamedArguments.CSharpUseNamedArgumentsCodeRefactoringProvider", "Use Named Arguments (Refactoring)" }, { "Microsoft.CodeAnalysis.CSharp.UseLocalFunction.CSharpUseLocalFunctionCodeFixProvider", "Use Local Function" }, { "Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyCodeRefactoringProvider", "Use Expression Body (Refactoring)" }, @@ -112,10 +112,10 @@ public class Program { "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", "Merge Consecutive If Statements (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.SplitOrMergeIfStatements.CSharpSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Into Nested If Statements (Refactoring)" }, + { "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" }, @@ -133,49 +133,49 @@ public class Program { "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", "Pass In Captured Variables As Arguments" }, + { "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 Local For Expression (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.IntroduceVariable.CSharpIntroduceParameterCodeRefactoringProvider", "Introduce Parameter (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", "Add Parameter Check (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.InitializeParameter.CSharpInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Member From Parameter (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementExplicitlyCodeRefactoringProvider", "Implement Explicitly (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.CSharpImplementImplicitlyCodeRefactoringProvider", "Implement Implicitly (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", "Json Detection" }, + { "Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.CSharpJsonDetectionCodeFixProvider", "Embedded Languages: Json Detection" }, { "Microsoft.CodeAnalysis.CSharp.Diagnostics.AddBraces.CSharpAddBracesCodeFixProvider", "Add Braces" }, { "Microsoft.CodeAnalysis.CSharp.ConvertTupleToStruct.CSharpConvertTupleToStructCodeRefactoringProvider", "Convert Tuple To Struct (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertToRawString.ConvertRegularStringToRawStringCodeRefactoringProvider", "Convert Regular String To Raw String (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertConcatenationToInterpolatedStringRefactoringProvider", "Convert Concatenation To Interpolated String (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertToInterpolatedString.CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert Placeholder To Interpolated String (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeFixProvider", "Convert To Program Main" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToProgramMainCodeRefactoringProvider", "Convert To Program Main (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeFixProvider", "Convert To Top Level Statements" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertProgram.ConvertToTopLevelStatementsCodeRefactoringProvider", "Convert To Top Level Statements (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.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 Direct Cast To Try Cast (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertCast.CSharpConvertTryCastToDirectCastCodeRefactoringProvider", "Convert Try Cast To Direct Cast (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.ConvertBetweenRegularAndVerbatimInterpolatedStringCodeRefactoringProvider", "Convert Between Regular And Verbatim Interpolated String (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", "Resolve Conflict Marker" }, + { "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)" }, @@ -190,13 +190,13 @@ public class Program { "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", "Change Namespace To Match Folder" }, + { "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.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.AddInheritdoc.AddInheritdocCodeFixProvider", "Add Inheritdoc" }, @@ -206,15 +206,15 @@ public class Program { "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 Conversion" }, + { "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", "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.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 Specific Package" }, + { "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)" }, @@ -229,21 +229,21 @@ public class Program { "Microsoft.CodeAnalysis.UseSystemHashCode.UseSystemHashCodeCodeFixProvider", "Use System Hash Code" }, { "Microsoft.CodeAnalysis.UseExplicitTupleName.UseExplicitTupleNameCodeFixProvider", "Use Explicit Tuple Name" }, { "Microsoft.CodeAnalysis.UseCoalesceExpression.UseCoalesceExpressionCodeFixProvider", "Use Coalesce Expression" }, - { "Microsoft.CodeAnalysis.UseCoalesceExpression.UseCoalesceExpressionForNullableCodeFixProvider", "Use Coalesce Expression For Nullable" }, - { "Microsoft.CodeAnalysis.SimplifyBooleanExpression.SimplifyConditionalCodeFixProvider", "Simplify Conditional" }, - { "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", "Multiple Blank Lines" }, { "Microsoft.CodeAnalysis.NewLines.ConsecutiveStatementPlacement.ConsecutiveStatementPlacementCodeFixProvider", "Consecutive Statement Placement" }, { "Microsoft.CodeAnalysis.AddRequiredParentheses.AddRequiredParenthesesCodeFixProvider", "Add Required Parentheses" }, - { "Microsoft.CodeAnalysis.Wrapping.WrapItemsAction", "Wrap Items" }, - { "Microsoft.CodeAnalysis.UpgradeProject.ProjectOptionsChangeAction", "Project Options Change" }, + { "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.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)" }, @@ -251,21 +251,21 @@ public class Program { "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.ExtractClass.ExtractClassWithDialogCodeAction", "Extract Class: With Dialog" }, { "Microsoft.CodeAnalysis.EncapsulateField.EncapsulateFieldRefactoringProvider", "Encapsulate Field (Refactoring)" }, - { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.ConvertRegularStringToInterpolatedStringRefactoringProvider", "Convert Regular String To Interpolated String (Refactoring)" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.FixAllCodeRefactoringCodeAction", "Fix All Code 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 Style" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.TopLevelSuppressionCodeAction", "Top Level Suppression" }, - { "Microsoft.CodeAnalysis.CodeFixes.Suppression.WrapperCodeFixProvider", "Wrapper" }, + { "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", "Install Package Directly" }, - { "Microsoft.CodeAnalysis.AddPackage.InstallPackageParentCodeAction", "Install Package Parent" }, - { "Microsoft.CodeAnalysis.AddPackage.InstallWithPackageManagerCodeAction", "Install With Package Manager" }, + { "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" }, @@ -316,16 +316,16 @@ public class Program { "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 Specific Package" }, + { "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.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 Conversion" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateMethod.GenerateParameterizedMemberCodeFixProvider", "Generate Parameterized Member" }, + { "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" }, @@ -333,41 +333,41 @@ public class Program { "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", "Change To Yield" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicConvertToIteratorCodeFixProvider", "Convert To Iterator" }, + { "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 Method (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", "Remove Statement" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConflictMarkerResolution.VisualBasicResolveConflictMarkerCodeFixProvider", "Resolve Conflict Marker" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertAnonymousType.VisualBasicConvertAnonymousTypeToClassCodeRefactoringProvider", "Convert Anonymous Type To Class (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 Direct Cast To Try Cast (Refactoring)" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertConversionOperators.VisualBasicConvertTryCastToDirectCastCodeRefactoringProvider", "Convert Try Cast To Direct Cast (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 Concatenation To Interpolated String (Refactoring)" }, - { "Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString.VisualBasicConvertPlaceholderToInterpolatedStringRefactoringProvider", "Convert Placeholder To Interpolated String (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", "Json Detection" }, + { "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", "Add Parameter Check (Refactoring)" }, - { "Microsoft.CodeAnalysis.VisualBasic.InitializeParameter.VisualBasicInitializeMemberFromParameterCodeRefactoringProvider", "Initialize Member From Parameter (Refactoring)" }, + { "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 Local For Expression (Refactoring)" }, - { "Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable.VisualBasicIntroduceParameterCodeRefactoringProvider", "Introduce Parameter (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 Multi Line If (Refactoring)" }, - { "Microsoft.CodeAnalysis.VisualBasic.InvertIf.VisualBasicInvertSingleLineIfCodeRefactoringProvider", "Invert Single Line If (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" }, @@ -381,35 +381,35 @@ public class Program { "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", "Merge Consecutive If Statements (Refactoring)" }, - { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements (Refactoring)" }, - { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements (Refactoring)" }, - { "Microsoft.CodeAnalysis.VisualBasic.SplitOrMergeIfStatements.VisualBasicSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Into Nested If Statements (Refactoring)" }, + { "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 Get Type To Name Of" }, - { "Microsoft.CodeAnalysis.VisualBasic.FileHeaders.VisualBasicFileHeaderCodeFixProvider", "File Header" }, + { "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.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 Values" }, + { "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.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.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" }, @@ -560,7 +560,16 @@ internal static string GenerateCodeActionsDescriptionMap(ImmutableArray Date: Mon, 13 Jun 2022 17:03:00 +0200 Subject: [PATCH 15/28] Fix VB compiler crashes when decoding attributes (#61537) Fixes #61492 --- .../Symbols/Attributes/AttributeData.vb | 72 ++- .../Symbols/Source/SourceAssemblySymbol.vb | 2 +- .../Symbols/Source/SourceFieldSymbol.vb | 2 +- .../Symbols/Source/SourceMethodSymbol.vb | 2 +- .../Symbols/Source/SourceModuleSymbol.vb | 2 +- .../Attributes/AttributeTests_StructLayout.vb | 31 + .../AttributeTests_WellKnownAttributes.vb | 565 +++++++++++++++++- 7 files changed, 629 insertions(+), 47 deletions(-) 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 From ff321442387e525a7896624764a09cae7f867de0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 13 Jun 2022 09:41:52 -0700 Subject: [PATCH 16/28] Lint --- .../Json/LanguageServices/JsonEmbeddedLanguage.cs | 3 --- 1 file changed, 3 deletions(-) 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; } From f04aec534140b4a46cdd321fc4aaf14076e718b8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 13 Jun 2022 10:11:31 -0700 Subject: [PATCH 17/28] Simplify export attribute for embedded language features --- Roslyn.sln | 12 ++-- ...sonEmbeddedLanguageBraceMatchingService.cs | 2 +- ...CSharpRegexEmbeddedLanguageBraceMatcher.cs | 2 +- ...rtEmbeddedLanguageBraceMatcherAttribute.cs | 50 ++------------ ...alBasicJsonEmbeddedLanguageBraceMatcher.vb | 2 +- ...lBasicRegexEmbeddedLanguageBraceMatcher.vb | 2 +- .../CSharpJsonEmbeddedLanguageClassifier.cs | 2 +- .../CSharpRegexEmbeddedLanguageClassifier.cs | 2 +- ...sualBasicJsonEmbeddedLanguageClassifier.vb | 2 +- ...ualBasicRegexEmbeddedLanguageClassifier.vb | 2 +- .../AspNetCoreEmbeddedLanguageBraceMatcher.cs | 2 +- .../AspNetCoreEmbeddedLanguageClassifier.cs | 2 +- .../ExportEmbeddedLanguageClassifier.cs | 50 ++------------ .../ExportEmbeddedLanguageClassifier.cs | 66 +++++++++++++++++++ 14 files changed, 90 insertions(+), 108 deletions(-) create mode 100644 src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs 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/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs index b072df403dae2..a99b25263b972 100644 --- a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs +++ b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonEmbeddedLanguageBraceMatchingService.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.EmbeddedLanguages { - [ExportEmbeddedLanguageBraceMatcherInternal( + [ExportEmbeddedLanguageBraceMatcher( PredefinedEmbeddedLanguageBraceMatcherNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] internal sealed class CSharpJsonEmbeddedLanguageBraceMatcher : AbstractJsonEmbeddedLanguageBraceMatcher diff --git a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs index 500a8c69f9229..80051f0b28bb4 100644 --- a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs +++ b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexEmbeddedLanguageBraceMatcher.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.EmbeddedLanguages { - [ExportEmbeddedLanguageBraceMatcherInternal( + [ExportEmbeddedLanguageBraceMatcher( PredefinedEmbeddedLanguageBraceMatcherNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] internal sealed class CSharpRegexEmbeddedLanguageBraceMatcher : AbstractRegexEmbeddedLanguageBraceMatcher diff --git a/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs b/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs index 3d9e379de85bc..236bdaaa734c0 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 : ExportEmbeddedLanguageAttribute { - /// - /// 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)) + : this(name, language, 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( + public ExportEmbeddedLanguageBraceMatcherAttribute( string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) - : base(name, language, identifiers) + : base(typeof(IEmbeddedLanguageBraceMatcher), name, language, supportsUnannotatedAPIs, identifiers) { - SupportsUnannotatedAPIs = supportsUnannotatedAPIs; } } } diff --git a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb index a1ded57111aeb..85dc5b50cc612 100644 --- a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb +++ b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageBraceMatcher.vb @@ -9,7 +9,7 @@ Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EmbeddedLanguages - Friend Class VisualBasicJsonEmbeddedLanguageBraceMatcher Inherits AbstractJsonEmbeddedLanguageBraceMatcher diff --git a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb index 577db240cb023..58205e1a93562 100644 --- a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb +++ b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageBraceMatcher.vb @@ -9,7 +9,7 @@ Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EmbeddedLanguages - Friend Class VisualBasicRegexEmbeddedLanguageBraceMatcher Inherits AbstractRegexEmbeddedLanguageBraceMatcher diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonEmbeddedLanguageClassifier.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonEmbeddedLanguageClassifier.cs index f17b7ebf38c61..b41771ce0860d 100644 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonEmbeddedLanguageClassifier.cs +++ b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonEmbeddedLanguageClassifier.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Features.EmbeddedLanguages { - [ExportEmbeddedLanguageClassifierInternal( + [ExportEmbeddedLanguageClassifier( PredefinedEmbeddedLanguageClassifierNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] internal class CSharpJsonEmbeddedLanguageClassifier : AbstractJsonEmbeddedLanguageClassifier { diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs index 929b2af473c16..5cb209d6d72ac 100644 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs +++ b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexEmbeddedLanguageClassifier.cs @@ -14,7 +14,7 @@ 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( + [ExportEmbeddedLanguageClassifier( PredefinedEmbeddedLanguageClassifierNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] internal class CSharpRegexEmbeddedLanguageClassifier : AbstractRegexEmbeddedLanguageClassifier { diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb index 88566a89e9ccb..4ddcd12a53ff2 100644 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb +++ b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonEmbeddedLanguageClassifier.vb @@ -9,7 +9,7 @@ Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices Namespace Microsoft.CodeAnalysis.VisualBasic.Features.EmbeddedLanguages - Friend Class VisualBasicJsonEmbeddedLanguageClassifier Inherits AbstractJsonEmbeddedLanguageClassifier diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb index 847389b65f68e..89816f2a8bfcd 100644 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb +++ b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageClassifier.vb @@ -12,7 +12,7 @@ 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 diff --git a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs index f88985d0856bd..210f21e90789e 100644 --- a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs +++ b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs @@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.Internal.EmbeddedLanguages { - [ExportEmbeddedLanguageBraceMatcherInternal( + [ExportEmbeddedLanguageBraceMatcher( nameof(AspNetCoreEmbeddedLanguageBraceMatcher), 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] diff --git a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs index d3d16fddda079..31e6d5b79ae36 100644 --- a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs +++ b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.Internal.EmbeddedLanguages { - [ExportEmbeddedLanguageClassifierInternal( + [ExportEmbeddedLanguageClassifier( nameof(AspNetCoreEmbeddedLanguageClassifier), 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] diff --git a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs index b9214d27103dc..99168073d51bc 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 : ExportEmbeddedLanguageAttribute { - /// - /// 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)) + : this(name, language, 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( + public ExportEmbeddedLanguageClassifierAttribute( string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) - : base(name, language, identifiers) + : base(typeof(IEmbeddedLanguageClassifier), name, language, supportsUnannotatedAPIs, identifiers) { - SupportsUnannotatedAPIs = supportsUnannotatedAPIs; } } } diff --git a/src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs b/src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs new file mode 100644 index 0000000000000..ee956610b89de --- /dev/null +++ b/src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs @@ -0,0 +1,66 @@ +// 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 ExportEmbeddedLanguageAttribute : ExportAttribute + { + /// + /// 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; } + + // If this type becomes public, this would still stay internal + /// + internal bool SupportsUnannotatedAPIs { get; } + + public ExportEmbeddedLanguageAttribute( + Type contractType, string name, string language, params string[] identifiers) + : this(contractType, name, language, supportsUnannotatedAPIs: false, identifiers) + { + } + + // If this type becomes public, this would still stay internal + internal ExportEmbeddedLanguageAttribute( + Type contractType, string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) + : base(contractType) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Language = language ?? throw new ArgumentNullException(nameof(language)); + Identifiers = identifiers ?? throw new ArgumentNullException(nameof(identifiers)); + SupportsUnannotatedAPIs = supportsUnannotatedAPIs; + + if (SupportsUnannotatedAPIs) + { + Contract.ThrowIfFalse(name is PredefinedEmbeddedLanguageClassifierNames.Regex or PredefinedEmbeddedLanguageClassifierNames.Json, + $"Only '{PredefinedEmbeddedLanguageClassifierNames.Regex}' or '{PredefinedEmbeddedLanguageClassifierNames.Json}' are allowed to '{nameof(SupportsUnannotatedAPIs)}'"); + } + } + } +} From a7695a6ed07efe311d64b8ea2f1864f586fc6e39 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 13 Jun 2022 10:17:27 -0700 Subject: [PATCH 18/28] Add check --- .../Classification/ExportEmbeddedLanguageClassifier.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs b/src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs index ee956610b89de..2b6fa0b6565e0 100644 --- a/src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs +++ b/src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs @@ -36,7 +36,6 @@ internal abstract class ExportEmbeddedLanguageAttribute : ExportAttribute /// public string[] Identifiers { get; } - // If this type becomes public, this would still stay internal /// internal bool SupportsUnannotatedAPIs { get; } @@ -46,7 +45,6 @@ public ExportEmbeddedLanguageAttribute( { } - // If this type becomes public, this would still stay internal internal ExportEmbeddedLanguageAttribute( Type contractType, string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) : base(contractType) @@ -56,6 +54,9 @@ internal ExportEmbeddedLanguageAttribute( 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 PredefinedEmbeddedLanguageClassifierNames.Regex or PredefinedEmbeddedLanguageClassifierNames.Json, From c3d42b0ad7b45be6ee0266b01e9a161a1f3bf394 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 13 Jun 2022 10:20:02 -0700 Subject: [PATCH 19/28] REname --- .../ExportEmbeddedLanguageBraceMatcherAttribute.cs | 2 +- .../EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs | 2 +- .../ExportEmbeddedLanguageFeatureServiceAttribute.cs} | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/Workspaces/Core/Portable/{Classification/ExportEmbeddedLanguageClassifier.cs => EmbeddedLanguages/ExportEmbeddedLanguageFeatureServiceAttribute.cs} (93%) diff --git a/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs b/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs index 236bdaaa734c0..7b814c84ce7a2 100644 --- a/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs +++ b/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.BraceMatching /// /// Use this attribute to export a . /// - internal class ExportEmbeddedLanguageBraceMatcherAttribute : ExportEmbeddedLanguageAttribute + internal class ExportEmbeddedLanguageBraceMatcherAttribute : ExportEmbeddedLanguageFeatureServiceAttribute { public ExportEmbeddedLanguageBraceMatcherAttribute( string name, string language, params string[] identifiers) diff --git a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs index 99168073d51bc..87bfa35988f3e 100644 --- a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs +++ b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.Classification /// /// Use this attribute to export a . /// - internal class ExportEmbeddedLanguageClassifierAttribute : ExportEmbeddedLanguageAttribute + internal class ExportEmbeddedLanguageClassifierAttribute : ExportEmbeddedLanguageFeatureServiceAttribute { public ExportEmbeddedLanguageClassifierAttribute( string name, string language, params string[] identifiers) diff --git a/src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/ExportEmbeddedLanguageFeatureServiceAttribute.cs similarity index 93% rename from src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs rename to src/Workspaces/Core/Portable/EmbeddedLanguages/ExportEmbeddedLanguageFeatureServiceAttribute.cs index 2b6fa0b6565e0..d7c8a79825605 100644 --- a/src/Workspaces/Core/Portable/Classification/ExportEmbeddedLanguageClassifier.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/ExportEmbeddedLanguageFeatureServiceAttribute.cs @@ -14,7 +14,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages /// [MetadataAttribute] [AttributeUsage(AttributeTargets.Class)] - internal abstract class ExportEmbeddedLanguageAttribute : ExportAttribute + internal abstract class ExportEmbeddedLanguageFeatureServiceAttribute : ExportAttribute { /// /// Name of the classifier. @@ -39,13 +39,13 @@ internal abstract class ExportEmbeddedLanguageAttribute : ExportAttribute /// internal bool SupportsUnannotatedAPIs { get; } - public ExportEmbeddedLanguageAttribute( + public ExportEmbeddedLanguageFeatureServiceAttribute( Type contractType, string name, string language, params string[] identifiers) : this(contractType, name, language, supportsUnannotatedAPIs: false, identifiers) { } - internal ExportEmbeddedLanguageAttribute( + internal ExportEmbeddedLanguageFeatureServiceAttribute( Type contractType, string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) : base(contractType) { From eee6b3c9180c77f4d58be0b2f8cafd2204297d10 Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Mon, 13 Jun 2022 11:14:05 -0700 Subject: [PATCH 20/28] Disallow an interface containing or inheriting static abstract/virtual members without implementation as a type argument (#61775) Closes #61461. --- .../CSharp/Portable/CSharpResources.resx | 2 +- .../Portable/Symbols/ConstraintsHelper.cs | 58 +- .../Portable/xlf/CSharpResources.cs.xlf | 4 +- .../Portable/xlf/CSharpResources.de.xlf | 4 +- .../Portable/xlf/CSharpResources.es.xlf | 4 +- .../Portable/xlf/CSharpResources.fr.xlf | 4 +- .../Portable/xlf/CSharpResources.it.xlf | 4 +- .../Portable/xlf/CSharpResources.ja.xlf | 4 +- .../Portable/xlf/CSharpResources.ko.xlf | 4 +- .../Portable/xlf/CSharpResources.pl.xlf | 4 +- .../Portable/xlf/CSharpResources.pt-BR.xlf | 4 +- .../Portable/xlf/CSharpResources.ru.xlf | 4 +- .../Portable/xlf/CSharpResources.tr.xlf | 4 +- .../Portable/xlf/CSharpResources.zh-Hans.xlf | 4 +- .../Portable/xlf/CSharpResources.zh-Hant.xlf | 4 +- .../Test/Emit2/Attributes/AttributeTests.cs | 15 +- .../CSharp/Test/Symbol/BadSymbolReference.cs | 12 + .../StaticAbstractMembersInInterfacesTests.cs | 775 ++++++++++++++++-- 18 files changed, 784 insertions(+), 130 deletions(-) diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index 36f9795e5f956..da96dd5a0e082 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -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. 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/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf index 705bb52302be9..dc05376f380c9 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf index 738cf7d8191c8..a08eaa5e23095 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf index cd26a9aed72bf..b0a288124775a 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf index bdc7bd13c0ef4..f7aa6bea5f4ac 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf index c5257dc722735..40b4171991f76 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf index c1f8f1aa44805..52e49283407bb 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf index 8b0a5edeecb24..610496080b7b7 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf index 45f669a3e71c6..b4992ed89dcb7 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf index f89d211e56616..19c13f0cef043 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf index 30c7985df5171..9e467af4ddc23 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf index 78fe1007cf2b9..8b85cd3927156 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf index 10822f4c623f3..5e3fd8916803b 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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf index fd727d9767934..ebebe85e15f22 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. 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/StaticAbstractMembersInInterfacesTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs index 3a8d4ed9bd809..0712e11431895 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs @@ -6336,6 +6336,387 @@ 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 {} @@ -6352,37 +6733,31 @@ 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. + // (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("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. + 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("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. + 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("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. + 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("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. + 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("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, "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("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 +6769,28 @@ void Test(C8 x) compilation2.VerifyDiagnostics(expected); } - [Theory] - [CombinatorialData] - public void ConstraintChecks_02(bool isVirtual) + [Fact] + public void ConstraintChecks_05() { - 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 +{ + abstract static void I1.M01(); +} + +public interface I3 : I2, I4 { - public static void M01() {} } "; var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, @@ -6425,48 +6801,200 @@ 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 + 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[] { + // (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.VerifyDiagnostics(expected); + } + + [Fact] + public void ConstraintChecks_06() + { + var source1 = +@" +public interface I1 +{ + virtual static void M01(){} +} + +public interface I2 : I1 +{ + static void I1.M01(){} +} + +public interface I4 : I1 +{ + 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) { - x.M(x); } +} + +class C2 +{ + 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) ); } @@ -28914,12 +29548,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), From 691d7096062727207809145c27753ce8ff2c9500 Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Mon, 13 Jun 2022 11:29:16 -0700 Subject: [PATCH 21/28] Organize contributing notes and add WSL testing section (#61408) --- ...ding, Debugging, and Testing on Windows.md | 56 ++++++++++++------- 1 file changed, 37 insertions(+), 19 deletions(-) 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. From 65f8ef67022b4e1d046445dc7b5ed2fd1ab25829 Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Mon, 13 Jun 2022 11:41:54 -0700 Subject: [PATCH 22/28] Require spaces within line span directives and relax LangVer check (#61686) --- .../Compiler Breaking Changes - DotNet 7.md | 11 + .../CSharp/Portable/CSharpResources.resx | 6 +- .../CSharp/Portable/Errors/ErrorCode.cs | 1 + .../CSharp/Portable/Errors/MessageID.cs | 3 +- .../CSharp/Portable/Parser/DirectiveParser.cs | 26 +- .../CSharp/Portable/Parser/LanguageParser.cs | 2 +- .../Portable/xlf/CSharpResources.cs.xlf | 10 +- .../Portable/xlf/CSharpResources.de.xlf | 10 +- .../Portable/xlf/CSharpResources.es.xlf | 10 +- .../Portable/xlf/CSharpResources.fr.xlf | 10 +- .../Portable/xlf/CSharpResources.it.xlf | 10 +- .../Portable/xlf/CSharpResources.ja.xlf | 10 +- .../Portable/xlf/CSharpResources.ko.xlf | 10 +- .../Portable/xlf/CSharpResources.pl.xlf | 10 +- .../Portable/xlf/CSharpResources.pt-BR.xlf | 10 +- .../Portable/xlf/CSharpResources.ru.xlf | 10 +- .../Portable/xlf/CSharpResources.tr.xlf | 10 +- .../Portable/xlf/CSharpResources.zh-Hans.xlf | 10 +- .../Portable/xlf/CSharpResources.zh-Hant.xlf | 10 +- .../Parsing/LineSpanDirectiveParsingTests.cs | 261 +++++++++++++++++- 20 files changed, 349 insertions(+), 91 deletions(-) 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/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index da96dd5a0e082..40294f5956b4d 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. diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index d5865961b3996..34d5138dd8559 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, 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/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf index dc05376f380c9..453e85763a433 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf @@ -837,6 +837,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 +1582,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 a08eaa5e23095..68d808ef1a66b 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf @@ -837,6 +837,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 +1582,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 b0a288124775a..ca27ba4e581ee 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf @@ -837,6 +837,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 +1582,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 f7aa6bea5f4ac..eb4d5341aca4c 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf @@ -837,6 +837,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 +1582,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 40b4171991f76..e101718116c6d 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf @@ -837,6 +837,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 +1582,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 52e49283407bb..7071f5dc27823 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf @@ -837,6 +837,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 +1582,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 610496080b7b7..d81e53d4bdf9c 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf @@ -837,6 +837,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 +1582,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 b4992ed89dcb7..2d0936b61a153 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf @@ -837,6 +837,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 +1582,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 19c13f0cef043..c7462cbb62b72 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf @@ -837,6 +837,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 +1582,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 9e467af4ddc23..f0409d0175ead 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf @@ -837,6 +837,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 +1582,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 8b85cd3927156..f16191fa74cfe 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf @@ -837,6 +837,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 +1582,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 5e3fd8916803b..b16b56007ea7a 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf @@ -837,6 +837,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 +1582,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 ebebe85e15f22..0cb6721325447 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf @@ -837,6 +837,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 +1582,6 @@ lambda 傳回型別 - - line span directive - line span 指示詞 - - list pattern 清單模式 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(); + } } } From 7a412313fba861c9a9510512467bcd8081d5ead1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 13 Jun 2022 12:28:12 -0700 Subject: [PATCH 23/28] Renames --- .../CSharpDocumentHighlightsService.cs | 2 +- ...htsService.cs => CSharpRegexDocumentHighlighter.cs} | 6 +++--- .../AbstractDocumentHighlightsService.cs | 4 ++-- ...ortEmbeddedLanguageDocumentHighlighterAttribute.cs} | 10 +++++----- ...vice.cs => IEmbeddedLanguageDocumentHighlighter.cs} | 2 +- ...sService.cs => AbstractRegexDocumentHighlighter.cs} | 4 ++-- .../VisualBasicDocumentHighlightsService.vb | 2 +- ...rvice.vb => VisualBasicRegexDocumentHighlighter.vb} | 6 +++--- 8 files changed, 18 insertions(+), 18 deletions(-) rename src/Features/CSharp/Portable/EmbeddedLanguages/{CSharpRegexDocumentHighlightsService.cs => CSharpRegexDocumentHighlighter.cs} (82%) rename src/Features/Core/Portable/DocumentHighlighting/{ExportEmbeddedLanguageBraceMatcherAttribute.cs => ExportEmbeddedLanguageDocumentHighlighterAttribute.cs} (62%) rename src/Features/Core/Portable/DocumentHighlighting/{IEmbeddedLanguageDocumentHighlightsService.cs => IEmbeddedLanguageDocumentHighlighter.cs} (89%) rename src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/{AbstractRegexDocumentHighlightsService.cs => AbstractRegexDocumentHighlighter.cs} (96%) rename src/Features/VisualBasic/Portable/EmbeddedLanguages/{VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb => VisualBasicRegexDocumentHighlighter.vb} (87%) diff --git a/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs b/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs index 2e120fbe7c6a7..729486de888cc 100644 --- a/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs +++ b/src/Features/CSharp/Portable/DocumentHighlighting/CSharpDocumentHighlightsService.cs @@ -27,7 +27,7 @@ internal class CSharpDocumentHighlightsService : AbstractDocumentHighlightsServi [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public CSharpDocumentHighlightsService( - [ImportMany] IEnumerable> services) + [ImportMany] IEnumerable> services) : base(LanguageNames.CSharp, CSharpEmbeddedLanguagesProvider.Info, CSharpSyntaxKinds.Instance, diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlightsService.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlighter.cs similarity index 82% rename from src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlightsService.cs rename to src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlighter.cs index 3564502a06379..02f9cb521f892 100644 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlightsService.cs +++ b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlighter.cs @@ -12,13 +12,13 @@ namespace Microsoft.CodeAnalysis.CSharp.Features.EmbeddedLanguages { [ExtensionOrder(Before = PredefinedEmbeddedLanguageNames.Json)] - [ExportEmbeddedLanguageDocumentHighlightsService( + [ExportEmbeddedLanguageDocumentHighlighter( PredefinedEmbeddedLanguageNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] - internal class CSharpRegexDocumentHighlightsService : AbstractRegexDocumentHighlightsService + internal class CSharpRegexDocumentHighlighter : AbstractRegexDocumentHighlighter { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpRegexDocumentHighlightsService() + public CSharpRegexDocumentHighlighter() : base(CSharpEmbeddedLanguagesProvider.Info) { } diff --git a/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs b/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs index defccd083018c..d3e7679e64fd8 100644 --- a/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/DocumentHighlighting/AbstractDocumentHighlightsService.cs @@ -21,14 +21,14 @@ namespace Microsoft.CodeAnalysis.DocumentHighlighting { internal abstract partial class AbstractDocumentHighlightsService : - AbstractEmbeddedLanguageFeatureService, + AbstractEmbeddedLanguageFeatureService, IDocumentHighlightsService { protected AbstractDocumentHighlightsService( string languageName, EmbeddedLanguageInfo info, ISyntaxKinds syntaxKinds, - IEnumerable> allServices) + IEnumerable> allServices) : base(languageName, info, syntaxKinds, allServices) { } diff --git a/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageBraceMatcherAttribute.cs b/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs similarity index 62% rename from src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageBraceMatcherAttribute.cs rename to src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs index 347f6d43a7be7..4592d47cf3a1f 100644 --- a/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageBraceMatcherAttribute.cs +++ b/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs @@ -7,19 +7,19 @@ namespace Microsoft.CodeAnalysis.DocumentHighlighting { /// - /// Use this attribute to export a . + /// Use this attribute to export a . /// - internal class ExportEmbeddedLanguageDocumentHighlightsServiceAttribute : ExportEmbeddedLanguageFeatureServiceAttribute + internal class ExportEmbeddedLanguageDocumentHighlighterAttribute : ExportEmbeddedLanguageFeatureServiceAttribute { - public ExportEmbeddedLanguageDocumentHighlightsServiceAttribute( + public ExportEmbeddedLanguageDocumentHighlighterAttribute( string name, string language, params string[] identifiers) : this(name, language, supportsUnannotatedAPIs: false, identifiers) { } - public ExportEmbeddedLanguageDocumentHighlightsServiceAttribute( + public ExportEmbeddedLanguageDocumentHighlighterAttribute( string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) - : base(typeof(IEmbeddedLanguageDocumentHighlightsService), name, language, supportsUnannotatedAPIs, identifiers) + : base(typeof(IEmbeddedLanguageDocumentHighlighter), name, language, supportsUnannotatedAPIs, identifiers) { } } diff --git a/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlighter.cs similarity index 89% rename from src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs rename to src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlighter.cs index 008230d99bebd..5d7e6fba9253b 100644 --- a/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/DocumentHighlighting/IEmbeddedLanguageDocumentHighlighter.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.DocumentHighlighting { /// - internal interface IEmbeddedLanguageDocumentHighlightsService : IEmbeddedLanguageFeatureService + internal interface IEmbeddedLanguageDocumentHighlighter : IEmbeddedLanguageFeatureService { /// ImmutableArray GetDocumentHighlights( diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlighter.cs similarity index 96% rename from src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs rename to src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlighter.cs index 2b4871998e2ee..3d97b028e2645 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlightsService.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlighter.cs @@ -16,11 +16,11 @@ namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.L { using RegexToken = EmbeddedSyntaxToken; - internal abstract class AbstractRegexDocumentHighlightsService : IEmbeddedLanguageDocumentHighlightsService + internal abstract class AbstractRegexDocumentHighlighter : IEmbeddedLanguageDocumentHighlighter { private readonly EmbeddedLanguageInfo _info; - protected AbstractRegexDocumentHighlightsService(EmbeddedLanguageInfo info) + protected AbstractRegexDocumentHighlighter(EmbeddedLanguageInfo info) => _info = info; public ImmutableArray GetDocumentHighlights( diff --git a/src/Features/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb b/src/Features/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb index c5f744f74e3c3..280a9004efa96 100644 --- a/src/Features/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb +++ b/src/Features/VisualBasic/Portable/DocumentHighlighting/VisualBasicDocumentHighlightsService.vb @@ -17,7 +17,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.DocumentHighlighting Public Sub New( - services As IEnumerable(Of Lazy(Of IEmbeddedLanguageDocumentHighlightsService, EmbeddedLanguageMetadata))) + services As IEnumerable(Of Lazy(Of IEmbeddedLanguageDocumentHighlighter, EmbeddedLanguageMetadata))) MyBase.New( LanguageNames.VisualBasic, VisualBasicEmbeddedLanguagesProvider.Info, diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexDocumentHighlighter.vb similarity index 87% rename from src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb rename to src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexDocumentHighlighter.vb index 995becd1ebadb..479bb67ee7eaa 100644 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexEmbeddedLanguageDocumentHighlightsService.vb +++ b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexDocumentHighlighter.vb @@ -13,10 +13,10 @@ 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 VisualBasicRegexDocumentHighlightsService - Inherits AbstractRegexDocumentHighlightsService + Friend Class VisualBasicRegexDocumentHighlighter + Inherits AbstractRegexDocumentHighlighter From 0662acdf086a8ba81ed992cb84d64015fb83c5ec Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Mon, 13 Jun 2022 12:37:14 -0700 Subject: [PATCH 24/28] Adjust implementation of user-defined conversion resolution according to the latest LDM decision (#61754) Closes #61470. Related to #56753. --- .../Semantics/Conversions/ConversionsBase.cs | 5 +- .../Conversions/UserDefinedConversions.cs | 37 ++--- .../UserDefinedExplicitConversions.cs | 41 +++-- .../UserDefinedImplicitConversions.cs | 43 +++--- .../Portable/Symbols/TypeParameterSymbol.cs | 12 ++ .../StaticAbstractMembersInInterfacesTests.cs | 144 +++++++++++++++--- 6 files changed, 192 insertions(+), 90 deletions(-) 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/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/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs index 0712e11431895..d53894d455d17 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs @@ -14771,7 +14771,7 @@ private static bool Execute(bool isVirtual) } #endif - return true; + return ExecutionConditionUtil.IsMonoOrCoreClr; } [ConditionalTheory(typeof(CoreClrOnly))] @@ -30548,7 +30548,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"; @@ -30596,13 +30596,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 = @" @@ -30618,7 +30621,7 @@ class Test { static T M02(int x) where T : U where U : I2 { - return " + (needCast ? "(T)" : "") + @"x; + return " + (useCast ? "(T)" : "") + @"x; } } "; @@ -30626,10 +30629,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 @@ -30644,6 +30649,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] @@ -30789,7 +30803,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"; @@ -30891,7 +30905,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"; @@ -30917,16 +30931,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] @@ -30959,16 +30989,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] From ca30a19828b6bc2bd223d23ff4eb44076baf1ff5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 13 Jun 2022 12:51:40 -0700 Subject: [PATCH 25/28] Simplify importing of embedded languages --- .../CSharpJsonBraceMatcher.cs | 25 ----------------- .../CSharpRegexBraceMatcher.cs | 25 ----------------- ...rtEmbeddedLanguageBraceMatcherAttribute.cs | 8 +++--- .../AbstractRegexBraceMatcher.cs | 11 +++----- .../VisualBasicJsonBraceMatcher.vb | 23 --------------- .../VisualBasicRegexBraceMatcher.vb | 23 --------------- .../EmbeddedLanguages/CSharpJsonClassifier.cs | 25 ----------------- .../CSharpRegexClassifier.cs | 28 ------------------- .../CSharpRegexDocumentHighlighter.cs | 26 ----------------- ...dedLanguageDocumentHighlighterAttribute.cs | 8 +++--- ...actJsonClassifier.cs => JsonClassifier.cs} | 22 +++++++++++---- ...tRegexClassifier.cs => RegexClassifier.cs} | 24 +++++++++++----- ...lighter.cs => RegexDocumentHighlighter.cs} | 22 +++++++++++---- .../VisualBasicJsonClassifier.vb | 23 --------------- .../VisualBasicRegexClassifier.vb | 26 ----------------- .../VisualBasicRegexDocumentHighlighter.vb | 27 ------------------ .../AspNetCoreEmbeddedLanguageBraceMatcher.cs | 4 ++- .../AspNetCoreEmbeddedLanguageClassifier.cs | 4 ++- ...ctEmbeddedLanguageClassificationService.cs | 7 +++-- .../EmbeddedLanguageClassifierContext.cs | 4 +-- .../ExportEmbeddedLanguageClassifier.cs | 8 +++--- .../AbstractEmbeddedLanguageFeatureService.cs | 2 +- .../EmbeddedLanguages/EmbeddedLanguageInfo.cs | 6 ++++ .../EmbeddedLanguageMetadata.cs | 10 +++++-- ...EmbeddedLanguageFeatureServiceAttribute.cs | 12 ++++---- 25 files changed, 98 insertions(+), 305 deletions(-) delete mode 100644 src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonBraceMatcher.cs delete mode 100644 src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexBraceMatcher.cs delete mode 100644 src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonBraceMatcher.vb delete mode 100644 src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexBraceMatcher.vb delete mode 100644 src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonClassifier.cs delete mode 100644 src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexClassifier.cs delete mode 100644 src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlighter.cs rename src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/{AbstractJsonClassifier.cs => JsonClassifier.cs} (89%) rename src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/{AbstractRegexClassifier.cs => RegexClassifier.cs} (93%) rename src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/{AbstractRegexDocumentHighlighter.cs => RegexDocumentHighlighter.cs} (87%) delete mode 100644 src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonClassifier.vb delete mode 100644 src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexClassifier.vb delete mode 100644 src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexDocumentHighlighter.vb diff --git a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonBraceMatcher.cs b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonBraceMatcher.cs deleted file mode 100644 index 9b3dff1af348a..0000000000000 --- a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpJsonBraceMatcher.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.BraceMatching; -using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.LanguageServices; -using Microsoft.CodeAnalysis.EmbeddedLanguages.Json; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.Editor.CSharp.EmbeddedLanguages -{ - [ExportEmbeddedLanguageBraceMatcher( - PredefinedEmbeddedLanguageNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] - internal sealed class CSharpJsonBraceMatcher : AbstractJsonBraceMatcher - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpJsonBraceMatcher() - : base(CSharpEmbeddedLanguagesProvider.Info) - { - } - } -} diff --git a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexBraceMatcher.cs b/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexBraceMatcher.cs deleted file mode 100644 index 565bc556abe99..0000000000000 --- a/src/EditorFeatures/CSharp/EmbeddedLanguages/CSharpRegexBraceMatcher.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.BraceMatching; -using Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.LanguageServices; -using Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.Editor.CSharp.EmbeddedLanguages -{ - [ExportEmbeddedLanguageBraceMatcher( - PredefinedEmbeddedLanguageNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] - internal sealed class CSharpRegexBraceMatcher : AbstractRegexBraceMatcher - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpRegexBraceMatcher() - : base(CSharpEmbeddedLanguagesProvider.Info) - { - } - } -} diff --git a/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs b/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs index 7b814c84ce7a2..8fe9fde58c357 100644 --- a/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs +++ b/src/EditorFeatures/Core/BraceMatching/ExportEmbeddedLanguageBraceMatcherAttribute.cs @@ -12,14 +12,14 @@ namespace Microsoft.CodeAnalysis.BraceMatching internal class ExportEmbeddedLanguageBraceMatcherAttribute : ExportEmbeddedLanguageFeatureServiceAttribute { public ExportEmbeddedLanguageBraceMatcherAttribute( - string name, string language, params string[] identifiers) - : this(name, language, supportsUnannotatedAPIs: false, identifiers) + string name, string[] languages, params string[] identifiers) + : this(name, languages, supportsUnannotatedAPIs: false, identifiers) { } public ExportEmbeddedLanguageBraceMatcherAttribute( - string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) - : base(typeof(IEmbeddedLanguageBraceMatcher), name, language, supportsUnannotatedAPIs, identifiers) + string name, string[] languages, bool supportsUnannotatedAPIs, params string[] identifiers) + : base(typeof(IEmbeddedLanguageBraceMatcher), name, languages, supportsUnannotatedAPIs, identifiers) { } } diff --git a/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexBraceMatcher.cs b/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexBraceMatcher.cs index 9d9950a12a127..620efdef41288 100644 --- a/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexBraceMatcher.cs +++ b/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexBraceMatcher.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.EmbeddedLanguages.Common; using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; using Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.LanguageServices; +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions { @@ -19,13 +20,8 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions /// /// Brace matching impl for embedded regex strings. /// - internal abstract class AbstractRegexBraceMatcher : IEmbeddedLanguageBraceMatcher + internal sealed class RegexBraceMatcher : IEmbeddedLanguageBraceMatcher { - private readonly EmbeddedLanguageInfo _info; - - protected AbstractRegexBraceMatcher(EmbeddedLanguageInfo info) - => _info = info; - public BraceMatchingResult? FindBraces( Project project, SemanticModel semanticModel, @@ -37,7 +33,8 @@ protected AbstractRegexBraceMatcher(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/VisualBasicJsonBraceMatcher.vb b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonBraceMatcher.vb deleted file mode 100644 index 75432ae869ca1..0000000000000 --- a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicJsonBraceMatcher.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 VisualBasicJsonBraceMatcher - Inherits AbstractJsonBraceMatcher - - - - Public Sub New() - MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) - End Sub - End Class -End Namespace diff --git a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexBraceMatcher.vb b/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexBraceMatcher.vb deleted file mode 100644 index 0056a49122cea..0000000000000 --- a/src/EditorFeatures/VisualBasic/EmbeddedLanguages/VisualBasicRegexBraceMatcher.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 VisualBasicRegexBraceMatcher - Inherits AbstractRegexBraceMatcher - - - - Public Sub New() - MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) - End Sub - End Class -End Namespace diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonClassifier.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonClassifier.cs deleted file mode 100644 index 6d82003cca449..0000000000000 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpJsonClassifier.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 -{ - [ExportEmbeddedLanguageClassifier( - PredefinedEmbeddedLanguageNames.Json, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Json"), Shared] - internal class CSharpJsonClassifier : AbstractJsonClassifier - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpJsonClassifier() - : base(CSharpEmbeddedLanguagesProvider.Info) - { - } - } -} diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexClassifier.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexClassifier.cs deleted file mode 100644 index ac68a92c43226..0000000000000 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexClassifier.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 = PredefinedEmbeddedLanguageNames.Json)] - [ExportEmbeddedLanguageClassifier( - PredefinedEmbeddedLanguageNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] - internal class CSharpRegexClassifier : AbstractRegexClassifier - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpRegexClassifier() - : base(CSharpEmbeddedLanguagesProvider.Info) - { - } - } -} diff --git a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlighter.cs b/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlighter.cs deleted file mode 100644 index 02f9cb521f892..0000000000000 --- a/src/Features/CSharp/Portable/EmbeddedLanguages/CSharpRegexDocumentHighlighter.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.CSharp.EmbeddedLanguages.LanguageServices; -using Microsoft.CodeAnalysis.DocumentHighlighting; -using Microsoft.CodeAnalysis.Features.EmbeddedLanguages.RegularExpressions.LanguageServices; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.CSharp.Features.EmbeddedLanguages -{ - [ExtensionOrder(Before = PredefinedEmbeddedLanguageNames.Json)] - [ExportEmbeddedLanguageDocumentHighlighter( - PredefinedEmbeddedLanguageNames.Regex, LanguageNames.CSharp, supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] - internal class CSharpRegexDocumentHighlighter : AbstractRegexDocumentHighlighter - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public CSharpRegexDocumentHighlighter() - : base(CSharpEmbeddedLanguagesProvider.Info) - { - } - } -} diff --git a/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs b/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs index 4592d47cf3a1f..93eb0ef2f21a1 100644 --- a/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs +++ b/src/Features/Core/Portable/DocumentHighlighting/ExportEmbeddedLanguageDocumentHighlighterAttribute.cs @@ -12,14 +12,14 @@ namespace Microsoft.CodeAnalysis.DocumentHighlighting internal class ExportEmbeddedLanguageDocumentHighlighterAttribute : ExportEmbeddedLanguageFeatureServiceAttribute { public ExportEmbeddedLanguageDocumentHighlighterAttribute( - string name, string language, params string[] identifiers) - : this(name, language, supportsUnannotatedAPIs: false, identifiers) + string name, string[] languages, params string[] identifiers) + : this(name, languages, supportsUnannotatedAPIs: false, identifiers) { } public ExportEmbeddedLanguageDocumentHighlighterAttribute( - string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) - : base(typeof(IEmbeddedLanguageDocumentHighlighter), name, language, supportsUnannotatedAPIs, identifiers) + string name, string[] languages, bool supportsUnannotatedAPIs, params string[] identifiers) + : base(typeof(IEmbeddedLanguageDocumentHighlighter), name, languages, supportsUnannotatedAPIs, identifiers) { } } diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonClassifier.cs similarity index 89% rename from src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonClassifier.cs rename to src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonClassifier.cs index 5b4ff21062573..034e7b29dd3c0 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonClassifier.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 AbstractJsonClassifier : 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 AbstractJsonClassifier(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/RegularExpressions/LanguageServices/AbstractRegexClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs similarity index 93% rename from src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexClassifier.cs rename to src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs index 638c1632d8c6d..dd75316f2ad88 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexClassifier.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 AbstractRegexClassifier : 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 AbstractRegexClassifier(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/AbstractRegexDocumentHighlighter.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs similarity index 87% rename from src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlighter.cs rename to src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs index 3d97b028e2645..588137c524637 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/AbstractRegexDocumentHighlighter.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs @@ -4,24 +4,32 @@ using System; using System.Collections.Immutable; +using System.Composition; using System.Threading; 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 abstract class AbstractRegexDocumentHighlighter : IEmbeddedLanguageDocumentHighlighter + [ExportEmbeddedLanguageDocumentHighlighter( + PredefinedEmbeddedLanguageNames.Regex, + new[] { LanguageNames.CSharp, LanguageNames.VisualBasic }, + supportsUnannotatedAPIs: true, "Regex", "Regexp"), Shared] + internal sealed class RegexDocumentHighlighter : IEmbeddedLanguageDocumentHighlighter { - private readonly EmbeddedLanguageInfo _info; - - protected AbstractRegexDocumentHighlighter(EmbeddedLanguageInfo info) - => _info = info; + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public RegexDocumentHighlighter() + { + } public ImmutableArray GetDocumentHighlights( Document document, SemanticModel semanticModel, SyntaxToken token, int position, HighlightingOptions options, CancellationToken cancellationToken) @@ -29,7 +37,9 @@ public ImmutableArray GetDocumentHighlights( if (!options.HighlightRelatedRegexComponentsUnderCursor) return default; - var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, _info); + var info = document.GetRequiredLanguageService().EmbeddedLanguageInfo; + + var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, info); var tree = detector.TryParseString(token, semanticModel, cancellationToken); return tree == null diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonClassifier.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonClassifier.vb deleted file mode 100644 index 7019e7e4e0c3a..0000000000000 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicJsonClassifier.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 VisualBasicJsonClassifier - Inherits AbstractJsonClassifier - - - - Public Sub New() - MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) - End Sub - End Class -End Namespace diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexClassifier.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexClassifier.vb deleted file mode 100644 index a5ebd4edf9e74..0000000000000 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexClassifier.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 VisualBasicRegexClassifier - Inherits AbstractRegexClassifier - - - - Public Sub New() - MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) - End Sub - End Class -End Namespace diff --git a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexDocumentHighlighter.vb b/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexDocumentHighlighter.vb deleted file mode 100644 index 479bb67ee7eaa..0000000000000 --- a/src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicRegexDocumentHighlighter.vb +++ /dev/null @@ -1,27 +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.DocumentHighlighting -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 VisualBasicRegexDocumentHighlighter - Inherits AbstractRegexDocumentHighlighter - - - - Public Sub New() - MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info) - End Sub - End Class -End Namespace diff --git a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs index 210f21e90789e..099b41fdc24e6 100644 --- a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs +++ b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageBraceMatcher.cs @@ -14,7 +14,9 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.Internal.EmbeddedLanguages { [ExportEmbeddedLanguageBraceMatcher( - nameof(AspNetCoreEmbeddedLanguageBraceMatcher), LanguageNames.CSharp, supportsUnannotatedAPIs: false, + 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 31e6d5b79ae36..9387445142ccc 100644 --- a/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs +++ b/src/Tools/ExternalAccess/AspNetCore/Internal/EmbeddedLanguages/AspNetCoreEmbeddedLanguageClassifier.cs @@ -11,7 +11,9 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.Internal.EmbeddedLanguages { [ExportEmbeddedLanguageClassifier( - nameof(AspNetCoreEmbeddedLanguageClassifier), LanguageNames.CSharp, supportsUnannotatedAPIs: false, + 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/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 87bfa35988f3e..896e99b644c8b 100644 --- a/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs +++ b/src/Workspaces/Core/Portable/Classification/EmbeddedLanguages/ExportEmbeddedLanguageClassifier.cs @@ -12,14 +12,14 @@ namespace Microsoft.CodeAnalysis.Classification internal class ExportEmbeddedLanguageClassifierAttribute : ExportEmbeddedLanguageFeatureServiceAttribute { public ExportEmbeddedLanguageClassifierAttribute( - string name, string language, params string[] identifiers) - : this(name, language, supportsUnannotatedAPIs: false, identifiers) + string name, string[] languages, params string[] identifiers) + : this(name, languages, supportsUnannotatedAPIs: false, identifiers) { } public ExportEmbeddedLanguageClassifierAttribute( - string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) - : base(typeof(IEmbeddedLanguageClassifier), name, language, supportsUnannotatedAPIs, identifiers) + string name, string[] languages, bool supportsUnannotatedAPIs, params string[] identifiers) + : base(typeof(IEmbeddedLanguageClassifier), name, languages, supportsUnannotatedAPIs, identifiers) { } } 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/EmbeddedLanguageInfo.cs b/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageInfo.cs index 9553e2b3ccf9d..b010b16c29220 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageInfo.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageInfo.cs @@ -4,11 +4,17 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Collections; namespace Microsoft.CodeAnalysis.EmbeddedLanguages { + internal interface IEmbeddedLanguageInfoProviderService : ILanguageService + { + EmbeddedLanguageInfo EmbeddedLanguageInfo { get; } + } + internal readonly struct EmbeddedLanguageInfo { public readonly ISyntaxFacts SyntaxFacts; 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 index eb5a9a9b22e7f..7bf1796a1c5ee 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/ExportEmbeddedLanguageFeatureServiceAttribute.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/ExportEmbeddedLanguageFeatureServiceAttribute.cs @@ -22,9 +22,9 @@ internal abstract class ExportEmbeddedLanguageFeatureServiceAttribute : ExportAt public string Name { get; } /// - /// Name of the containing language hosting the embedded language. e.g. C# or VB. + /// Names of the containing language hosting the embedded language. e.g. C# or VB. /// - public string Language { get; } + public string[] Languages { get; } /// /// Identifiers in code (or StringSyntaxAttribute) used to identify an embedded language string. For example @@ -40,17 +40,17 @@ internal abstract class ExportEmbeddedLanguageFeatureServiceAttribute : ExportAt internal bool SupportsUnannotatedAPIs { get; } public ExportEmbeddedLanguageFeatureServiceAttribute( - Type contractType, string name, string language, params string[] identifiers) - : this(contractType, name, language, supportsUnannotatedAPIs: false, identifiers) + Type contractType, string name, string[] languages, params string[] identifiers) + : this(contractType, name, languages, supportsUnannotatedAPIs: false, identifiers) { } internal ExportEmbeddedLanguageFeatureServiceAttribute( - Type contractType, string name, string language, bool supportsUnannotatedAPIs, params string[] identifiers) + Type contractType, string name, string[] languages, bool supportsUnannotatedAPIs, params string[] identifiers) : base(contractType) { Name = name ?? throw new ArgumentNullException(nameof(name)); - Language = language ?? throw new ArgumentNullException(nameof(language)); + Languages = languages ?? throw new ArgumentNullException(nameof(languages)); Identifiers = identifiers ?? throw new ArgumentNullException(nameof(identifiers)); SupportsUnannotatedAPIs = supportsUnannotatedAPIs; From a9f6300c9fa6710f8f60b5b49640c95aaf8b1b5b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 13 Jun 2022 12:59:22 -0700 Subject: [PATCH 26/28] simplify further --- ...sonBraceMatcher.cs => JsonBraceMatcher.cs} | 23 ++++++++++++++----- ...exBraceMatcher.cs => RegexBraceMatcher.cs} | 15 +++++++++++- ...stractEmbeddedLanguagesFeaturesProvider.cs | 1 + .../Json/LanguageServices/JsonClassifier.cs | 2 +- .../LanguageServices/RegexClassifier.cs | 5 +--- .../RegexDocumentHighlighter.cs | 2 +- .../CSharpEmbeddedLanguagesProvider.cs | 4 +--- .../AbstractEmbeddedLanguagesProvider.cs | 4 +++- .../EmbeddedLanguages/EmbeddedLanguageInfo.cs | 5 ---- .../IEmbeddedLanguagesProvider.cs | 1 + .../VisualBasicEmbeddedLanguagesProvider.vb | 1 + 11 files changed, 41 insertions(+), 22 deletions(-) rename src/EditorFeatures/Core/EmbeddedLanguages/Json/{AbstractJsonBraceMatcher.cs => JsonBraceMatcher.cs} (84%) rename src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/{AbstractRegexBraceMatcher.cs => RegexBraceMatcher.cs} (92%) diff --git a/src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonBraceMatcher.cs b/src/EditorFeatures/Core/EmbeddedLanguages/Json/JsonBraceMatcher.cs similarity index 84% rename from src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonBraceMatcher.cs rename to src/EditorFeatures/Core/EmbeddedLanguages/Json/JsonBraceMatcher.cs index abf09b90b5673..98ca3effb4f6b 100644 --- a/src/EditorFeatures/Core/EmbeddedLanguages/Json/AbstractJsonBraceMatcher.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 AbstractJsonBraceMatcher : IEmbeddedLanguageBraceMatcher + [ExportEmbeddedLanguageBraceMatcher( + PredefinedEmbeddedLanguageNames.Json, + new[] { LanguageNames.CSharp, LanguageNames.VisualBasic }, + supportsUnannotatedAPIs: true, + "Json"), Shared] + internal sealed class JsonBraceMatcher : IEmbeddedLanguageBraceMatcher { - private readonly EmbeddedLanguageInfo _info; - - public AbstractJsonBraceMatcher(EmbeddedLanguageInfo info) - => _info = info; + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public JsonBraceMatcher() + { + } public BraceMatchingResult? FindBraces( Project project, @@ -36,7 +46,8 @@ public AbstractJsonBraceMatcher(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/AbstractRegexBraceMatcher.cs b/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/RegexBraceMatcher.cs similarity index 92% rename from src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexBraceMatcher.cs rename to src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/RegexBraceMatcher.cs index 620efdef41288..ad557e7d64b1e 100644 --- a/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/AbstractRegexBraceMatcher.cs +++ b/src/EditorFeatures/Core/EmbeddedLanguages/RegularExpressions/RegexBraceMatcher.cs @@ -4,12 +4,14 @@ 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 @@ -20,8 +22,19 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions /// /// Brace matching impl for embedded regex strings. /// + [ExportEmbeddedLanguageBraceMatcher( + PredefinedEmbeddedLanguageNames.Regex, + new[] { LanguageNames.CSharp, LanguageNames.VisualBasic }, + supportsUnannotatedAPIs: true, + "Regex", "Regexp"), Shared] internal sealed class RegexBraceMatcher : IEmbeddedLanguageBraceMatcher { + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public RegexBraceMatcher() + { + } + public BraceMatchingResult? FindBraces( Project project, SemanticModel semanticModel, @@ -33,7 +46,7 @@ internal sealed class RegexBraceMatcher : IEmbeddedLanguageBraceMatcher if (!options.HighlightingOptions.HighlightRelatedRegexComponentsUnderCursor) return null; - var info = project.GetRequiredLanguageService().EmbeddedLanguageInfo; + var info = project.GetRequiredLanguageService().EmbeddedLanguageInfo; var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, info); var tree = detector.TryParseString(token, semanticModel, 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/Json/LanguageServices/JsonClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonClassifier.cs index 034e7b29dd3c0..8ae6ca955f550 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonClassifier.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonClassifier.cs @@ -37,7 +37,7 @@ public JsonClassifier() public void RegisterClassifications(EmbeddedLanguageClassificationContext context) { - var info = context.Project.GetRequiredLanguageService().EmbeddedLanguageInfo; + var info = context.Project.GetRequiredLanguageService().EmbeddedLanguageInfo; var token = context.SyntaxToken; if (!info.IsAnyStringLiteral(token.RawKind)) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs index dd75316f2ad88..4a1146d3c869f 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs @@ -2,13 +2,11 @@ // 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; @@ -32,14 +30,13 @@ internal sealed class RegexClassifier : IEmbeddedLanguageClassifier private static readonly ObjectPool s_visitorPool = SharedPools.Default(); [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public RegexClassifier() { } public void RegisterClassifications(EmbeddedLanguageClassificationContext context) { - var info = context.Project.GetRequiredLanguageService().EmbeddedLanguageInfo; + var info = context.Project.GetRequiredLanguageService().EmbeddedLanguageInfo; var token = context.SyntaxToken; if (!info.IsAnyStringLiteral(token.RawKind)) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs index 588137c524637..e0810d43b0a6e 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexDocumentHighlighter.cs @@ -37,7 +37,7 @@ public ImmutableArray GetDocumentHighlights( if (!options.HighlightRelatedRegexComponentsUnderCursor) return default; - var info = document.GetRequiredLanguageService().EmbeddedLanguageInfo; + var info = document.GetRequiredLanguageService().EmbeddedLanguageInfo; var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, info); var tree = detector.TryParseString(token, semanticModel, cancellationToken); 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/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 b010b16c29220..85e268d45c3c2 100644 --- a/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageInfo.cs +++ b/src/Workspaces/Core/Portable/EmbeddedLanguages/EmbeddedLanguageInfo.cs @@ -10,11 +10,6 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages { - internal interface IEmbeddedLanguageInfoProviderService : ILanguageService - { - EmbeddedLanguageInfo EmbeddedLanguageInfo { get; } - } - internal readonly struct EmbeddedLanguageInfo { public readonly ISyntaxFacts SyntaxFacts; 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/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 From 34088e0a1fdbcd44a9af077287267af13994a6f6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 13 Jun 2022 15:01:47 -0700 Subject: [PATCH 27/28] Lint --- .../RegularExpressions/LanguageServices/RegexClassifier.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs index 4a1146d3c869f..00c5c0a280d05 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexClassifier.cs @@ -2,11 +2,13 @@ // 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; @@ -30,6 +32,7 @@ internal sealed class RegexClassifier : IEmbeddedLanguageClassifier private static readonly ObjectPool s_visitorPool = SharedPools.Default(); [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public RegexClassifier() { } From dada467833fb5faa18d17542219fa3cf7975d37a Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Mon, 13 Jun 2022 15:57:57 -0700 Subject: [PATCH 28/28] Report an error for an implicit implementation of an inaccessible interface members (#61717) Closes #60885. --- .../CSharp/Portable/CSharpResources.resx | 3 + .../CSharp/Portable/Errors/ErrorCode.cs | 1 + ...berContainerSymbol_ImplementationChecks.cs | 2 +- .../CSharp/Portable/Symbols/TypeSymbol.cs | 31 +- .../Portable/xlf/CSharpResources.cs.xlf | 5 + .../Portable/xlf/CSharpResources.de.xlf | 5 + .../Portable/xlf/CSharpResources.es.xlf | 5 + .../Portable/xlf/CSharpResources.fr.xlf | 5 + .../Portable/xlf/CSharpResources.it.xlf | 5 + .../Portable/xlf/CSharpResources.ja.xlf | 5 + .../Portable/xlf/CSharpResources.ko.xlf | 5 + .../Portable/xlf/CSharpResources.pl.xlf | 5 + .../Portable/xlf/CSharpResources.pt-BR.xlf | 5 + .../Portable/xlf/CSharpResources.ru.xlf | 5 + .../Portable/xlf/CSharpResources.tr.xlf | 5 + .../Portable/xlf/CSharpResources.zh-Hans.xlf | 5 + .../Portable/xlf/CSharpResources.zh-Hant.xlf | 5 + .../DefaultInterfaceImplementationTests.cs | 1710 ++++++++++++----- .../StaticAbstractMembersInInterfacesTests.cs | 37 +- .../UpgradeProject/UpgradeProjectTests.cs | 4 +- 20 files changed, 1352 insertions(+), 501 deletions(-) diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index 40294f5956b4d..4ce4f67cfeb7d 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -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 34d5138dd8559..3934b176ce6a6 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -2088,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/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/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 453e85763a433..9107d38fdcb41 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf @@ -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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf index 68d808ef1a66b..06bcf1349cf24 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf @@ -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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf index ca27ba4e581ee..82b93565f069e 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf @@ -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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf index eb4d5341aca4c..76efa2ef017a8 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf @@ -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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf index e101718116c6d..1d351656705c5 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf @@ -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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf index 7071f5dc27823..a26d48e06359d 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf @@ -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. 暗黙的なインデックス インデクサーの呼び出しでは、引数に名前を付けることはできません。 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf index d81e53d4bdf9c..bd04981258c72 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf @@ -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. 암시적 인덱스 인덱서 호출로 인수 이름을 지정할 수 없습니다. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf index 2d0936b61a153..32a438a1adf15 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf @@ -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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf index c7462cbb62b72..591357163e376 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf @@ -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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf index f0409d0175ead..85aa878b454bd 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf @@ -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. Вызов неявного индексатора для индекса не может присвоить аргументу имя. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf index f16191fa74cfe..9bfa411e7c8af 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf @@ -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. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf index b16b56007ea7a..efb086f71931a 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf @@ -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. 无法通过对隐式索引索引器的调用为参数命名。 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf index 0cb6721325447..43ebf5ec70aab 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf @@ -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 索引子的引動過程無法為引數命名。 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 d53894d455d17..20d4478936bb2 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs @@ -23351,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) { @@ -23494,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) { @@ -23661,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"); @@ -23837,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) { @@ -24004,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"); 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,