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

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
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix analyzer [RCS0053](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0053) ([PR](https://github.com/dotnet/roslynator/pull/1518))

## [4.12.5] - 2024-09-13

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@ static bool AnalyzeToken(SyntaxToken token, bool isOpen)
return true;
}

if (token.IsParentKind(SyntaxKind.SwitchExpression))
return true;

if (token.IsParentKind(SyntaxKind.ObjectInitializerExpression)
&& token.Parent.Parent.IsKind(
SyntaxKind.ObjectCreationExpression,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,25 @@ public string M2(string value, string[] values)
}
}

""");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.FixFormattingOfList)]
public async Task TestNoDiagnostic_Multiline_SwitchExpression()
{
await VerifyNoDiagnosticAsync("""
using System;

class C
{
string M(string value) =>
M(value switch
{
"a" => "a",
"b" => "b",
_ => throw new Exception()
});
}
""");
}
}