Skip to content

Commit c0e0bd2

Browse files
committed
C#: Fix type mention extraction of named types with nullability enabled
1 parent c2a4235 commit c0e0bd2

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,13 @@ public static IEnumerable<IParameterSymbol> GetParameters(this ISymbol parameter
497497
/// <summary>
498498
/// Holds if this symbol is a source declaration.
499499
/// </summary>
500-
public static bool IsSourceDeclaration(this ISymbol symbol) => SymbolEqualityComparer.Default.Equals(symbol, symbol.OriginalDefinition);
500+
public static bool IsSourceDeclaration(this ISymbol symbol) => SymbolEqualityComparer.IncludeNullability.Equals(symbol, symbol.OriginalDefinition);
501501

502502
/// <summary>
503503
/// Holds if this method is a source declaration.
504504
/// </summary>
505505
public static bool IsSourceDeclaration(this IMethodSymbol method) =>
506-
IsSourceDeclaration((ISymbol)method) && SymbolEqualityComparer.Default.Equals(method, method.ConstructedFrom) && method.ReducedFrom == null;
506+
IsSourceDeclaration((ISymbol)method) && SymbolEqualityComparer.IncludeNullability.Equals(method, method.ConstructedFrom) && method.ReducedFrom == null;
507507

508508
/// <summary>
509509
/// Holds if this parameter is a source declaration.

csharp/ql/test/library-tests/typeMentions/nullable-disable/TypeMentions.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
| Program.cs:6:24:6:27 | Base |
2-
| Program.cs:6:24:6:27 | Base |
3-
| Program.cs:8:23:8:24 | I0 |
42
| Program.cs:8:23:8:24 | I0 |
53
| Program.cs:9:21:9:22 | I1 |
64
| Program.cs:13:12:13:15 | Void |

csharp/ql/test/library-tests/typeMentions/nullable-enable/TypeMentions.expected

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
| Program.cs:6:24:6:27 | Base |
2-
| Program.cs:6:24:6:27 | Base |
3-
| Program.cs:6:24:6:27 | Base |
4-
| Program.cs:8:23:8:24 | I0 |
5-
| Program.cs:8:23:8:24 | I0 |
62
| Program.cs:8:23:8:24 | I0 |
73
| Program.cs:9:21:9:22 | I1 |
84
| Program.cs:13:12:13:15 | Void |

0 commit comments

Comments
 (0)