Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/Syntax/SyntaxNormalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,11 @@ private static bool NeedsSeparator(SyntaxToken token, SyntaxToken next)
return true;
}

if (token.Parent.Parent?.Kind() == SyntaxKind.SuppressNullableWarningExpression)
{
return false;
}

if (IsKeyword(token.Kind()) && !token.IsKind(SyntaxKind.ExtensionKeyword))
{
if (!next.IsKind(SyntaxKind.ColonToken) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6236,6 +6236,36 @@ static class E
{
}
}
""");
}

[Fact]
public void TestNormalizeSuppression_01()
{
TestNormalizeDeclaration("""
throw null!;
""", """
throw null!;
""");
}

[Fact]
public void TestNormalizeSuppression_02()
{
TestNormalizeDeclaration("""
throw x!;
""", """
throw x!;
""");
}

[Fact]
public void TestNormalizeSuppression_03()
{
TestNormalizeDeclaration("""
M()!;
""", """
M()!;
""");
}
}
Expand Down