diff --git a/ChangeLog.md b/ChangeLog.md index c187b27a9d..26f4e63410 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [CLI] Fix exit code when multiple projects are processed ([#1061](https://github.com/JosefPihrt/Roslynator/pull/1061) by @PeterKaszab). - Fix code fix for CS0164 ([#1031](https://github.com/JosefPihrt/Roslynator/pull/1031)). - Do not report `System.Windows.DependencyPropertyChangedEventArgs` as unused parameter ([RCS1163](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1163.md)) ([#1068](https://github.com/JosefPihrt/Roslynator/pull/1068)). +- Fix ([RCS1032](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1032.md)) ([#1064](https://github.com/JosefPihrt/Roslynator/pull/1064)). ## [4.2.0] - 2022-11-27 diff --git a/src/Analyzers/CSharp/Analysis/RemoveRedundantParenthesesAnalyzer.cs b/src/Analyzers/CSharp/Analysis/RemoveRedundantParenthesesAnalyzer.cs index fafd105da0..b1efae1c48 100644 --- a/src/Analyzers/CSharp/Analysis/RemoveRedundantParenthesesAnalyzer.cs +++ b/src/Analyzers/CSharp/Analysis/RemoveRedundantParenthesesAnalyzer.cs @@ -92,7 +92,8 @@ private static void AnalyzeParenthesizedExpression(SyntaxNodeAnalysisContext con case SyntaxKind.GreaterThanOrEqualExpression: case SyntaxKind.EqualsExpression: case SyntaxKind.NotEqualsExpression: - { + case SyntaxKind.SimpleMemberAccessExpression: + { if (expression.IsKind(SyntaxKind.IdentifierName) || expression is LiteralExpressionSyntax) { diff --git a/src/Tests/Analyzers.Tests/RCS1032RemoveRedundantParenthesesTests.cs b/src/Tests/Analyzers.Tests/RCS1032RemoveRedundantParenthesesTests.cs index eb2b48de97..58df6034f7 100644 --- a/src/Tests/Analyzers.Tests/RCS1032RemoveRedundantParenthesesTests.cs +++ b/src/Tests/Analyzers.Tests/RCS1032RemoveRedundantParenthesesTests.cs @@ -254,6 +254,7 @@ void M() [InlineData(@"M([|(|]""""));", @"M("""");")] [InlineData("var arr = new string[] { [|(|]null) };", "var arr = new string[] { null };")] [InlineData("var items = new List() { [|(|]null) };", "var items = new List() { null };")] + [InlineData("var x = [|(|]i).ToString();","var x = i.ToString();")] [InlineData(@"s = $""{[|(|]"""")}"";", @"s = $""{""""}"";")] [InlineData("[|(|]i) = [|(|]0);", "i = 0;")] [InlineData("[|(|]i) += [|(|]0);", "i += 0;")]