Skip to content

Commit e257003

Browse files
authored
Merge pull request #15660 from tamasvajk/feature/code-quality
C#: Use `nameof` in nullability attributes
2 parents 6662274 + b3f5beb commit e257003

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

csharp/autobuilder/Semmle.Autobuild.Shared/BuildActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public interface IBuildActions
140140
/// <summary>
141141
/// Returns the file name and extension of the specified path string.
142142
/// </summary>
143-
[return: NotNullIfNotNull("path")]
143+
[return: NotNullIfNotNull(nameof(path))]
144144
string? GetFileName(string? path);
145145

146146
/// <summary>

csharp/extractor/Semmle.Extraction.CSharp/Entities/Constructor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private ConstructorDeclarationSyntax? Syntax
126126
}
127127
}
128128

129-
[return: NotNullIfNotNull("constructor")]
129+
[return: NotNullIfNotNull(nameof(constructor))]
130130
public static new Constructor? Create(Context cx, IMethodSymbol? constructor)
131131
{
132132
if (constructor is null)

csharp/extractor/Semmle.Extraction.CSharp/Entities/Method.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public static void AddExplicitInterfaceQualifierToId(Context cx, EscapingTextWri
232232
/// <param name="cx"></param>
233233
/// <param name="methodDecl"></param>
234234
/// <returns></returns>
235-
[return: NotNullIfNotNull("methodDecl")]
235+
[return: NotNullIfNotNull(nameof(methodDecl))]
236236
public static Method? Create(Context cx, IMethodSymbol? methodDecl)
237237
{
238238
if (methodDecl is null)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ public static bool IsSourceDeclaration(this IParameterSymbol parameter)
591591
public static INamedTypeSymbol? GetNonObjectBaseType(this ITypeSymbol symbol, Context cx) =>
592592
symbol is ITypeParameterSymbol || SymbolEqualityComparer.Default.Equals(symbol.BaseType, cx.Compilation.ObjectType) ? null : symbol.BaseType;
593593

594-
[return: NotNullIfNotNull("symbol")]
594+
[return: NotNullIfNotNull(nameof(symbol))]
595595
public static IEntity? CreateEntity(this Context cx, ISymbol symbol)
596596
{
597597
if (symbol is null)

0 commit comments

Comments
 (0)