Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,38 @@ public void TestMethod(string? x)
}
}
}
";

await VerifyCSharpFixAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, fixedCode, CancellationToken.None).ConfigureAwait(false);
}

[Fact]
public async Task TestNullForgivingOperatorBeforeInvocationAsync()
{
var testCode = @"
namespace TestNamespace
{
public class TestClass
{
public void TestMethod(System.Action? x)
{
x[|!|] ();
}
}
}
";

var fixedCode = @"
namespace TestNamespace
{
public class TestClass
{
public void TestMethod(System.Action? x)
{
x!();
}
}
}
";

await VerifyCSharpFixAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, fixedCode, CancellationToken.None).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ private static void HandlePostfixUnaryExpression(SyntaxNodeAnalysisContext conte
{
case SyntaxKind.CloseParenToken:
case SyntaxKind.OpenBracketToken: // Example: x![i]
case SyntaxKind.OpenParenToken: // Example: x!()
case SyntaxKind.CloseBracketToken:
case SyntaxKind.SemicolonToken:
case SyntaxKind.CommaToken:
Expand Down