Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE1006: Support multiple underscores #68086

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -726,12 +726,12 @@ public static bool IsKind<TSymbol>(this ISymbol symbol, SymbolKind kind, [NotNul

/// <summary>
/// Returns true for symbols whose name starts with an underscore and
/// are optionally followed by an integer, such as '_', '_1', '_2', etc.
/// are optionally followed by an integer or other underscores, such as '_', '_1', '_2', '__', '___', etc.
/// These are treated as special discard symbol names.
/// </summary>
public static bool IsSymbolWithSpecialDiscardName(this ISymbol symbol)
=> symbol.Name.StartsWith("_") &&
(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _));
(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));

/// <summary>
/// Returns <see langword="true"/>, if the symbol is marked with the <see cref="System.ObsoleteAttribute"/>.
Expand Down