@@ -65,8 +65,7 @@ private static void Handle(SyntaxNodeAnalysisContext context)
6565 }
6666 }
6767
68- if ( member . Match == FilterMatch . Ambiguous &&
69- member . ReflectedType is { } )
68+ if ( member is { Match : FilterMatch . Ambiguous , ReflectedType : not null } )
7069 {
7170 context . ReportDiagnostic (
7271 Diagnostic . Create (
@@ -108,8 +107,7 @@ private static void Handle(SyntaxNodeAnalysisContext context)
108107 $ " Expected: { flagsText } .") ) ;
109108 }
110109
111- if ( member . Match == FilterMatch . WrongMemberType &&
112- member . Symbol is { } )
110+ if ( member is { Match : FilterMatch . WrongMemberType , Symbol : not null } )
113111 {
114112 context . ReportDiagnostic (
115113 Diagnostic . Create (
@@ -132,8 +130,7 @@ private static void Handle(SyntaxNodeAnalysisContext context)
132130 callText ) ) ;
133131 }
134132
135- if ( member . Match == FilterMatch . UseContainingType &&
136- member . Symbol is { } )
133+ if ( member is { Match : FilterMatch . UseContainingType , Symbol : not null } )
137134 {
138135 context . ReportDiagnostic (
139136 Diagnostic . Create (
@@ -164,8 +161,7 @@ private static void Handle(SyntaxNodeAnalysisContext context)
164161 nameText ) ) ;
165162 }
166163
167- if ( member . Match == FilterMatch . ExplicitImplementation &&
168- member . Symbol is { } )
164+ if ( member is { Match : FilterMatch . ExplicitImplementation , Symbol : not null } )
169165 {
170166 context . ReportDiagnostic (
171167 Diagnostic . Create (
@@ -319,8 +315,7 @@ private static bool TryGetX(SyntaxNodeAnalysisContext context, out ReflectedMemb
319315
320316 private static bool HasMissingFlags ( ReflectedMember member , Flags flags , [ NotNullWhen ( true ) ] out Location ? location , [ NotNullWhen ( true ) ] out string ? flagsText )
321317 {
322- if ( member . Symbol is { } symbol &&
323- member . ReflectedType is { } &&
318+ if ( member is { Symbol : { } symbol , ReflectedType : not null } &&
324319 Flags . TryGetExpectedBindingFlags ( member . ReflectedType , symbol , out var correctFlags ) &&
325320 member . Invocation ? . ArgumentList is { } argumentList &&
326321 ( member . Match == FilterMatch . Single || member . Match == FilterMatch . WrongFlags ) )
@@ -367,9 +362,7 @@ Location MissingFlagsLocation()
367362
368363 private static bool HasWrongFlags ( ReflectedMember member , Flags flags , [ NotNullWhen ( true ) ] out Location ? location , [ NotNullWhen ( true ) ] out string ? flagText )
369364 {
370- if ( member . Match == FilterMatch . WrongFlags &&
371- member . Symbol is { } &&
372- member . ReflectedType is { } &&
365+ if ( member is { Symbol : { } , ReflectedType : not null , Match : FilterMatch . WrongFlags } &&
373366 Flags . TryGetExpectedBindingFlags ( member . ReflectedType , member . Symbol , out var correctFlags ) )
374367 {
375368 flagText = correctFlags . ToDisplayString ( flags . Argument ) ;
@@ -491,8 +484,7 @@ private static bool UsesNameOfWrongMember(ReflectedMember member, Name name, Syn
491484 NameOf . IsNameOf ( argument , out var expression ) )
492485 {
493486 if ( member . Match == FilterMatch . NoMatch ||
494- ( member . Match == FilterMatch . PotentiallyInvisible &&
495- member . Symbol is not IMethodSymbol ) )
487+ member is { Match : FilterMatch . PotentiallyInvisible , Symbol : not IMethodSymbol } )
496488 {
497489 nameText = $ "\" { name . MetadataName } \" ";
498490 location = argument . GetLocation ( ) ;
@@ -541,8 +533,7 @@ private static bool IsPreferGetMemberThenAccessor(ReflectedMember member, Name n
541533 return TryGetEventAccessor ( MemberName ( eventSymbol ) , bindingFlags , out callText ) ;
542534 }
543535 }
544- else if ( member . Match == FilterMatch . PotentiallyInvisible &&
545- member . ReflectedType is { } &&
536+ else if ( member is { Match : FilterMatch . PotentiallyInvisible , ReflectedType : not null } &&
546537 types . Argument is null &&
547538 flags . Explicit . HasFlagFast ( BindingFlags . NonPublic ) )
548539 {
@@ -683,7 +674,7 @@ string MemberName(ISymbol associatedSymbol)
683674
684675 private static bool HasMissingTypes ( ReflectedMember member , Types types , SyntaxNodeAnalysisContext context , [ NotNullWhen ( true ) ] out string ? typesArrayText )
685676 {
686- if ( ( member . Symbol as IMethodSymbol ) ? . AssociatedSymbol != null )
677+ if ( member . Symbol is IMethodSymbol { AssociatedSymbol : not null } )
687678 {
688679 typesArrayText = null ;
689680 return false ;
0 commit comments