Skip to content

Add tests for indentation around C# 9 patterns.#43606

Merged
1 commit merged intodotnet:features/patterns3from
dpoeschl:PatternsIndentation
Apr 27, 2020
Merged

Add tests for indentation around C# 9 patterns.#43606
1 commit merged intodotnet:features/patterns3from
dpoeschl:PatternsIndentation

Conversation

@dpoeschl
Copy link
Contributor

No description provided.

@dpoeschl dpoeschl requested a review from a team as a code owner April 23, 2020 17:14
var y = x switch
{{
{line1}
{line2} => true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether straight alignment (12, the actual value) is expected or one more indented (16) would be better. The current behavior (12) matches what happens in switches for regular boolean expressions, so having these similar patterns behave the same way seems fine for now to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more woudl be preferred. but if you're matching boolean exprs that's ok.

[InlineData("x is < 7 and (>= 3 or > 50) or not", "<= 0;", 12)]
[InlineData("x is < 7 and (>= 3 or > 50) or not <=", "0;", 12)]
[InlineData("x is < 7 and (>= 3 or > 50) or not <= 0", ";", 12)]
public async Task IndentPatternsInLocalDeclarationCSharp9(string line1, string line2, int expectedIndentation)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the indentation is always the same, might want to take that out of hte inline data and make it more clearly part of the expected result.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approval

@ghost ghost merged commit 5b7bbe0 into dotnet:features/patterns3 Apr 27, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants