Skip to content

Commit c700890

Browse files
committed
Add [NotNullWhen(true)]
1 parent 5f4da6e commit c700890

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • ReflectionAnalyzers/Helpers/Reflection/Filters

ReflectionAnalyzers/Helpers/Reflection/Filters/Types.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ internal bool TryMostSpecific(ISymbol? x, ISymbol? y, Compilation compilation, [
108108
return true;
109109
}
110110

111-
if (this.Expressions.IsEmpty)
111+
if (this.Argument is null ||
112+
this.Expressions.IsEmpty)
112113
{
113114
unique = null;
114115
return false;
@@ -150,9 +151,7 @@ x is null ||
150151
if (TryExact(this.Symbols, x, out unique) ||
151152
TryExact(this.Symbols, y, out unique))
152153
{
153-
#pragma warning disable CS8762 // Parameter must have a non-null value when exiting in some condition.
154154
return true;
155-
#pragma warning restore CS8762 // Parameter must have a non-null value when exiting in some condition.
156155
}
157156

158157
if (this.Matches(x.Parameters, compilation) &&
@@ -189,7 +188,7 @@ x is null ||
189188
unique = null;
190189
return false;
191190

192-
static bool TryExact(ImmutableArray<ITypeSymbol> symbols, IMethodSymbol method, out ISymbol? result)
191+
static bool TryExact(ImmutableArray<ITypeSymbol> symbols, IMethodSymbol method, [NotNullWhen(true)] out ISymbol? result)
193192
{
194193
if (method.Parameters.Length != symbols.Length)
195194
{

0 commit comments

Comments
 (0)