mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C#: Do not insert a synthetic ToString call in interpolation expressions, if the type implements IFormattable.
This commit is contained in:
@@ -532,6 +532,12 @@ namespace Semmle.Extraction.CSharp
|
||||
return isInline;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this type implements `System.IFormattable`.
|
||||
/// </summary>
|
||||
public static bool ImplementsIFormattable(this ITypeSymbol type) =>
|
||||
type.AllInterfaces.Any(i => i.Name == "IFormattable" && i.ContainingNamespace.ToString() == "System");
|
||||
|
||||
/// <summary>
|
||||
/// Holds if this type is of the form <code>System.ReadOnlySpan<byte></code>.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user