diff --git a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs index 49d8f5d8ec531..c8065add4eb18 100644 --- a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs @@ -5,7 +5,6 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.CodeStyle; -using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics.NamingStyles; using Microsoft.CodeAnalysis.ImplementType; @@ -9485,39 +9484,23 @@ class C : {|CS0535:ITest|} { } ", - FixedState = - { - Sources = - { - @" + FixedCode = @" interface ITest { static abstract void M1(); } -class C : {|#0:ITest|} +class C : ITest { - void ITest.{|#1:M1|}() + static void ITest.M1() { throw new System.NotImplementedException(); } } ", - }, - ExpectedDiagnostics = - { - // /0/Test0.cs(7,11): error CS0535: 'C' does not implement interface member 'ITest.M1()' - DiagnosticResult.CompilerError("CS0535").WithLocation(0).WithArguments("C", "ITest.M1()"), - // /0/Test0.cs(9,16): error CS0539: 'C.M1()' in explicit interface declaration is not found among members of the interface that can be implemented - DiagnosticResult.CompilerError("CS0539").WithLocation(1).WithArguments("C.M1()"), - }, - }, CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_all_members_explicitly, codeAction.Title), CodeActionEquivalenceKey = "True;False;False:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", CodeActionIndex = 1, - - // 🐛 This code fix is broken due to a missing 'static' keyword - CodeFixTestBehaviors = CodeFixTestBehaviors.FixOne, }.RunAsync(); } @@ -9539,11 +9522,7 @@ abstract class C : {|CS0535:ITest|} { } ", - FixedState = - { - Sources = - { - @" + FixedCode = @" interface ITest { static abstract void M1(); @@ -9551,20 +9530,353 @@ interface ITest abstract class C : ITest { - public abstract static void {|#0:M1|}(); + public static void M1() + { + throw new System.NotImplementedException(); + } } ", - }, - ExpectedDiagnostics = - { - // /0/Test0.cs(9,33): error CS0112: A static member cannot be marked as 'abstract' - DiagnosticResult.CompilerError("CS0112").WithLocation(0).WithArguments("abstract"), - }, - }, CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_interface_abstractly, codeAction.Title), CodeActionEquivalenceKey = "False;True;True:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", CodeActionIndex = 1, }.RunAsync(); } + + [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + public async Task TestStaticAbstractInterfaceOperator_OnlyExplicitlyImplementable() + { + await new VerifyCS.Test + { + ReferenceAssemblies = ReferenceAssemblies.Net.Net50, + LanguageVersion = LanguageVersion.Preview, + TestCode = @" +interface ITest +{ + static abstract int operator -(ITest x); +} +class C : {|CS0535:ITest|} +{ +} +", + FixedCode = @" +interface ITest +{ + static abstract int operator -(ITest x); +} +class C : ITest +{ + static int ITest.operator -(ITest x) + { + throw new System.NotImplementedException(); + } +} +", + CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_all_members_explicitly, codeAction.Title), + CodeActionEquivalenceKey = "True;False;False:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", + CodeActionIndex = 0, + }.RunAsync(); + } + + [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + public async Task TestStaticAbstractInterfaceOperator_ImplementImplicitly() + { + await new VerifyCS.Test + { + ReferenceAssemblies = ReferenceAssemblies.Net.Net50, + LanguageVersion = LanguageVersion.Preview, + TestCode = @" +interface ITest where T : ITest +{ + static abstract int operator -(T x); + static abstract int operator -(T x, int y); +} +class C : {|CS0535:{|CS0535:ITest|}|} +{ +} +", + FixedCode = @" +interface ITest where T : ITest +{ + static abstract int operator -(T x); + static abstract int operator -(T x, int y); +} +class C : ITest +{ + public static int operator -(C x) + { + throw new System.NotImplementedException(); + } + + public static int operator -(C x, int y) + { + throw new System.NotImplementedException(); + } +} +", + CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_interface, codeAction.Title), + CodeActionEquivalenceKey = "False;False;True:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", + CodeActionIndex = 0, + }.RunAsync(); + } + + [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + public async Task TestStaticAbstractInterfaceOperator_ImplementExplicitly() + { + await new VerifyCS.Test + { + ReferenceAssemblies = ReferenceAssemblies.Net.Net50, + LanguageVersion = LanguageVersion.Preview, + TestCode = @" +interface ITest where T : ITest +{ + static abstract int operator -(T x); +} +class C : {|CS0535:ITest|} +{ +} +", + FixedCode = @" +interface ITest where T : ITest +{ + static abstract int operator -(T x); +} +class C : ITest +{ + static int ITest.operator -(C x) + { + throw new System.NotImplementedException(); + } +} +", + CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_all_members_explicitly, codeAction.Title), + CodeActionEquivalenceKey = "True;False;False:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", + CodeActionIndex = 1, + }.RunAsync(); + } + + [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + public async Task TestStaticAbstractInterfaceOperator_ImplementAbstractly() + { + await new VerifyCS.Test + { + ReferenceAssemblies = ReferenceAssemblies.Net.Net50, + LanguageVersion = LanguageVersion.Preview, + TestCode = @" +interface ITest where T : ITest +{ + static abstract int operator -(T x); +} +abstract class C : {|CS0535:ITest|} +{ +} +", + FixedCode = @" +interface ITest where T : ITest +{ + static abstract int operator -(T x); +} +abstract class C : ITest +{ + public static int operator -(C x) + { + throw new System.NotImplementedException(); + } +} +", + CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_interface_abstractly, codeAction.Title), + CodeActionEquivalenceKey = "False;True;True:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", + CodeActionIndex = 1, + + }.RunAsync(); + } + + [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + public async Task TestStaticAbstractInterface_Explicitly() + { + await new VerifyCS.Test + { + ReferenceAssemblies = ReferenceAssemblies.Net.Net50, + LanguageVersion = LanguageVersion.Preview, + TestCode = @" +interface ITest +{ + static abstract int M(ITest x); +} +class C : {|CS0535:ITest|} +{ +} +", + FixedCode = @" +interface ITest +{ + static abstract int M(ITest x); +} +class C : ITest +{ + static int ITest.M(ITest x) + { + throw new System.NotImplementedException(); + } +} +", + CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_all_members_explicitly, codeAction.Title), + CodeActionEquivalenceKey = "True;False;False:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", + CodeActionIndex = 1, + + }.RunAsync(); + } + + [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + public async Task TestStaticAbstractInterface_Implicitly() + { + await new VerifyCS.Test + { + ReferenceAssemblies = ReferenceAssemblies.Net.Net50, + LanguageVersion = LanguageVersion.Preview, + TestCode = @" +interface ITest +{ + static abstract int M(ITest x); +} +class C : {|CS0535:ITest|} +{ +} +", + FixedCode = @" +interface ITest +{ + static abstract int M(ITest x); +} +class C : ITest +{ + public static int M(ITest x) + { + throw new System.NotImplementedException(); + } +} +", + CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_interface, codeAction.Title), + CodeActionEquivalenceKey = "False;False;True:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", + CodeActionIndex = 0, + + }.RunAsync(); + } + + [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + public async Task TestStaticAbstractInterface_ImplementImplicitly() + { + await new VerifyCS.Test + { + ReferenceAssemblies = ReferenceAssemblies.Net.Net50, + LanguageVersion = LanguageVersion.Preview, + TestCode = @" +interface ITest where T : ITest +{ + static abstract int M(T x); +} +class C : {|CS0535:ITest|} +{ +} +", + FixedCode = @" +interface ITest where T : ITest +{ + static abstract int M(T x); +} +class C : ITest +{ + public static int M(C x) + { + throw new System.NotImplementedException(); + } +} +", + CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_interface, codeAction.Title), + CodeActionEquivalenceKey = "False;False;True:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", + CodeActionIndex = 0, + + }.RunAsync(); + } + + [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + public async Task TestStaticAbstractInterface_ImplementExplicitly() + { + await new VerifyCS.Test + { + ReferenceAssemblies = ReferenceAssemblies.Net.Net50, + LanguageVersion = LanguageVersion.Preview, + TestCode = @" +interface ITest where T : ITest +{ + static abstract int M(T x); +} +class C : {|CS0535:ITest|} +{ +} +", + FixedCode = @" +interface ITest where T : ITest +{ + static abstract int M(T x); +} +class C : ITest +{ + static int ITest.M(C x) + { + throw new System.NotImplementedException(); + } +} +", + CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_all_members_explicitly, codeAction.Title), + CodeActionEquivalenceKey = "True;False;False:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", + CodeActionIndex = 1, + + }.RunAsync(); + } + + [WorkItem(53927, "https://github.com/dotnet/roslyn/issues/53927")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + public async Task TestStaticAbstractInterface_ImplementAbstractly() + { + await new VerifyCS.Test + { + ReferenceAssemblies = ReferenceAssemblies.Net.Net50, + LanguageVersion = LanguageVersion.Preview, + TestCode = @" +interface ITest where T : ITest +{ + static abstract int M(T x); +} +abstract class C : {|CS0535:ITest|} +{ +} +", + FixedCode = @" +interface ITest where T : ITest +{ + static abstract int M(T x); +} +abstract class C : ITest +{ + public static int M(C x) + { + throw new System.NotImplementedException(); + } +} +", + CodeActionVerifier = (codeAction, verifier) => verifier.Equal(FeaturesResources.Implement_interface_abstractly, codeAction.Title), + CodeActionEquivalenceKey = "False;True;True:global::ITest;TestProject;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;", + CodeActionIndex = 1, + + }.RunAsync(); + } } } diff --git a/src/EditorFeatures/Test/CodeGeneration/CodeGenerationTests.Shared.cs b/src/EditorFeatures/Test/CodeGeneration/CodeGenerationTests.Shared.cs index 81e2cfb3ee098..40cbb9df11e6a 100644 --- a/src/EditorFeatures/Test/CodeGeneration/CodeGenerationTests.Shared.cs +++ b/src/EditorFeatures/Test/CodeGeneration/CodeGenerationTests.Shared.cs @@ -705,7 +705,7 @@ public class A public static abstract string Property1 { get; } public virtual string Property { get; } - public abstract static void Method2(); + public static abstract void Method2(); public virtual void Method1(); } diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction.cs index 3ef768df2533d..8d308dfc95efa 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction.cs @@ -309,7 +309,9 @@ private ISymbol GenerateMember( var generateInvisibleMember = GenerateInvisibleMember(member, memberName); memberName = generateInvisibleMember ? member.Name : memberName; - var generateAbstractly = !generateInvisibleMember && Abstractly; + // The language doesn't allow static abstract implementations of interface methods. i.e, + // Only interface member is declared abstract static, but implementation should be only static. + var generateAbstractly = !member.IsStatic && !generateInvisibleMember && Abstractly; // Check if we need to add 'new' to the signature we're adding. We only need to do this // if we're not generating something explicit and we have a naming conflict with diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction_Method.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction_Method.cs index fb8f63adbdd11..7ec7b25926695 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction_Method.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction_Method.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.Collections.Immutable; using Microsoft.CodeAnalysis.CodeGeneration; using Microsoft.CodeAnalysis.Editing; @@ -25,7 +23,7 @@ private ISymbol GenerateMethod( bool useExplicitInterfaceSymbol, string memberName) { - var syntaxFacts = Document.GetLanguageService(); + var syntaxFacts = Document.GetRequiredLanguageService(); var updatedMethod = method.EnsureNonConflictingNames(State.ClassOrStructType, syntaxFacts); diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs index bf8f904398b2b..451fb52bf6cdf 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs @@ -220,9 +220,14 @@ private static SyntaxTokenList GenerateModifiers( { var tokens = ArrayBuilder.GetInstance(); - // Only "unsafe" modifier allowed if we're an explicit impl. + // Only "static" and "unsafe" modifiers allowed if we're an explicit impl. if (method.ExplicitInterfaceImplementations.Any()) { + if (method.IsStatic) + { + tokens.Add(SyntaxFactory.Token(SyntaxKind.StaticKeyword)); + } + if (CodeGenerationMethodInfo.GetIsUnsafe(method)) { tokens.Add(SyntaxFactory.Token(SyntaxKind.UnsafeKeyword)); @@ -237,6 +242,11 @@ private static SyntaxTokenList GenerateModifiers( { AddAccessibilityModifiers(method.DeclaredAccessibility, tokens, options, Accessibility.Private); + if (method.IsStatic) + { + tokens.Add(SyntaxFactory.Token(SyntaxKind.StaticKeyword)); + } + if (method.IsAbstract) { tokens.Add(SyntaxFactory.Token(SyntaxKind.AbstractKeyword)); @@ -247,11 +257,6 @@ private static SyntaxTokenList GenerateModifiers( tokens.Add(SyntaxFactory.Token(SyntaxKind.SealedKeyword)); } - if (method.IsStatic) - { - tokens.Add(SyntaxFactory.Token(SyntaxKind.StaticKeyword)); - } - // Don't show the readonly modifier if the containing type is already readonly // ContainingSymbol is used to guard against methods which are not members of their ContainingType (e.g. lambdas and local functions) if (method.IsReadOnly && (method.ContainingSymbol as INamedTypeSymbol)?.IsReadOnly != true) diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/OperatorGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/OperatorGenerator.cs index 819a5ab6d9bed..570cdbf4041d7 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/OperatorGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/OperatorGenerator.cs @@ -10,7 +10,8 @@ using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; - +using Microsoft.CodeAnalysis.Shared.Collections; +using Microsoft.CodeAnalysis.Shared.Extensions; using static Microsoft.CodeAnalysis.CodeGeneration.CodeGenerationHelpers; using static Microsoft.CodeAnalysis.CSharp.CodeGeneration.CSharpCodeGenerationHelpers; @@ -74,7 +75,7 @@ private static OperatorDeclarationSyntax GenerateOperatorDeclarationWorker( CodeGenerationOptions options, ParseOptions parseOptions) { - var hasNoBody = !options.GenerateMethodBodies || method.IsExtern; + var hasNoBody = !options.GenerateMethodBodies || method.IsExtern || method.IsAbstract; var operatorSyntaxKind = SyntaxFacts.GetOperatorKind(method.MetadataName); if (operatorSyntaxKind == SyntaxKind.None) @@ -86,23 +87,37 @@ private static OperatorDeclarationSyntax GenerateOperatorDeclarationWorker( var operatorDecl = SyntaxFactory.OperatorDeclaration( attributeLists: AttributeGenerator.GenerateAttributeLists(method.GetAttributes(), options), - modifiers: GenerateModifiers(), + modifiers: GenerateModifiers(method), returnType: method.ReturnType.GenerateTypeSyntax(), + explicitInterfaceSpecifier: GenerateExplicitInterfaceSpecifier(method.ExplicitInterfaceImplementations), operatorKeyword: SyntaxFactory.Token(SyntaxKind.OperatorKeyword), operatorToken: operatorToken, parameterList: ParameterGenerator.GenerateParameterList(method.Parameters, isExplicit: false, options: options), body: hasNoBody ? null : StatementGenerator.GenerateBlock(method), + expressionBody: null, semicolonToken: hasNoBody ? SyntaxFactory.Token(SyntaxKind.SemicolonToken) : new SyntaxToken()); operatorDecl = UseExpressionBodyIfDesired(options, operatorDecl, parseOptions); return operatorDecl; } - private static SyntaxTokenList GenerateModifiers() + private static SyntaxTokenList GenerateModifiers(IMethodSymbol method) { - return SyntaxFactory.TokenList( - SyntaxFactory.Token(SyntaxKind.PublicKeyword), - SyntaxFactory.Token(SyntaxKind.StaticKeyword)); + using var tokens = TemporaryArray.Empty; + + if (method.ExplicitInterfaceImplementations.Length == 0) + { + tokens.Add(SyntaxFactory.Token(SyntaxKind.PublicKeyword)); + } + + tokens.Add(SyntaxFactory.Token(SyntaxKind.StaticKeyword)); + + if (method.IsAbstract) + { + tokens.Add(SyntaxFactory.Token(SyntaxKind.AbstractKeyword)); + } + + return tokens.ToImmutableAndClear().ToSyntaxTokenList(); } } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/INamedTypeSymbolExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/INamedTypeSymbolExtensions.cs index 5e0c583c26b07..1eaaf5a0a9d74 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/INamedTypeSymbolExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/INamedTypeSymbolExtensions.cs @@ -204,7 +204,8 @@ static ImmutableArray GetImplicitlyImplementableMembers(INamedTypeSymbo { return type.GetMembers().WhereAsArray(m => m.DeclaredAccessibility == Accessibility.Public && m.Kind != SymbolKind.NamedType && IsImplementable(m) && - !IsPropertyWithNonPublicImplementableAccessor(m)); + !IsPropertyWithNonPublicImplementableAccessor(m) && + IsImplicitlyImplementable(m, within)); } return type.GetMembers(); @@ -226,6 +227,22 @@ static bool IsNonPublicImplementableAccessor(IMethodSymbol? accessor) { return accessor != null && IsImplementable(accessor) && accessor.DeclaredAccessibility != Accessibility.Public; } + + static bool IsImplicitlyImplementable(ISymbol member, ISymbol within) + { + if (member is IMethodSymbol { IsStatic: true, IsAbstract: true, MethodKind: MethodKind.UserDefinedOperator } method) + { + // For example, the following is not implementable implicitly. + // interface I { static abstract int operator -(I x); } + // But the following is implementable: + // interface I where T : I { static abstract int operator -(T x); } + + // See https://github.com/dotnet/csharplang/blob/main/spec/classes.md#unary-operators. + return method.Parameters.Any(p => p.Type.Equals(within, SymbolEqualityComparer.Default)); + } + + return true; + } } private static bool IsImplementable(ISymbol m) @@ -396,7 +413,7 @@ private static ImmutableArray GetUnimplementedMembers( { var q = from m in interfaceMemberGetter(interfaceType, classOrStructType) where m.Kind != SymbolKind.NamedType - where m.Kind != SymbolKind.Method || ((IMethodSymbol)m).MethodKind == MethodKind.Ordinary + where m.Kind != SymbolKind.Method || ((IMethodSymbol)m).MethodKind is MethodKind.Ordinary or MethodKind.UserDefinedOperator where m.Kind != SymbolKind.Property || ((IPropertySymbol)m).IsIndexer || ((IPropertySymbol)m).CanBeReferencedByName where m.Kind != SymbolKind.Event || ((IEventSymbol)m).CanBeReferencedByName where !isImplemented(classOrStructType, m, isValidImplementation, cancellationToken)