Add diagnostics for incorrect double precision annotations

このコミットが含まれているのは:
Sergio Pedri committed 2023-12-16 18:13:32 +01:00
1 親 f16dcab8fd
コミット 0051423caa
6ファイル変更
+90 -6

検索条件に一致するファイルはありません

+14 -6
ファイルの表示
@@ -33,6 +33,18 @@ internal sealed record DiagnosticInfo(
return Diagnostic.Create(Descriptor, null, Arguments.ToArray());
}
/// <summary>
/// Creates a new <see cref="DiagnosticInfo"/> instance with the specified parameters.
/// </summary>
/// <param name="descriptor">The input <see cref="DiagnosticDescriptor"/> for the diagnostics to create.</param>
/// <param name="location">The location to use for the diagnostic.</param>
/// <param name="args">The optional arguments for the formatted message to include.</param>
/// <returns>A new <see cref="DiagnosticInfo"/> instance with the specified parameters.</returns>
public static DiagnosticInfo Create(DiagnosticDescriptor descriptor, Location? location, params object[] args)
{
return new(descriptor, location?.SourceTree, location?.SourceSpan ?? default, args.Select(static arg => arg.ToString()).ToImmutableArray());
}
/// <summary>
/// Creates a new <see cref="DiagnosticInfo"/> instance with the specified parameters.
/// </summary>
@@ -42,9 +54,7 @@ internal sealed record DiagnosticInfo(
/// <returns>A new <see cref="DiagnosticInfo"/> instance with the specified parameters.</returns>
public static DiagnosticInfo Create(DiagnosticDescriptor descriptor, ISymbol symbol, params object[] args)
{
Location location = symbol.Locations.First();
return new(descriptor, location.SourceTree, location.SourceSpan, args.Select(static arg => arg.ToString()).ToImmutableArray());
return Create(descriptor, symbol.Locations.First(), args);
}
/// <summary>
@@ -56,8 +66,6 @@ internal sealed record DiagnosticInfo(
/// <returns>A new <see cref="DiagnosticInfo"/> instance with the specified parameters.</returns>
public static DiagnosticInfo Create(DiagnosticDescriptor descriptor, SyntaxNode node, params object[] args)
{
Location location = node.GetLocation();
return new(descriptor, location.SourceTree, location.SourceSpan, args.Select(static arg => arg.ToString()).ToImmutableArray());
return Create(descriptor, node.GetLocation(), args);
}
}