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

Update SA1011 to not require space before a range operator #3709

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,25 @@ public void TestMethod(object?[] arguments)

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

[Fact]
[WorkItem(3708, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3708")]
public async Task TestClosingSquareBracketFollowedByRangeAsync()
{
var testCode = @"namespace TestNamespace
{
public class TestClass
{
public void TestMethod(int[] arg)
{
_ = arg[0]..;
_ = arg[0] ..;
}
}
}
";

await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ private static void HandleCloseBracketToken(SyntaxTreeAnalysisContext context, S
case SyntaxKind.OpenBracketToken:
case SyntaxKind.CloseParenToken:
case SyntaxKind.MinusGreaterThanToken:
case SyntaxKindEx.DotDotToken:
precedesSpecialCharacter = true;
break;

Expand Down