Skip to content

Fixer for Use pattern matching doesn't respect parentheses for binary operators configuration #80749

@meziantou

Description

@meziantou

Version Used: Compiler version: '5.0.0-2.25505.1 (c847160)'. Language version: 14.0.

Steps to Reproduce:

Create an .editorconfig with the following configuration

[*.cs]
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
int a = 10;
_ = (a > -1 && a < 100) || (a > 0 && a < 1);
Image

Diagnostic Id: IDE0078

Expected Behavior:

_ = a is (> -1 and < 100) or (> 0 and < 1);

Actual Behavior:

_ = a is > (-1) and < 100 or > 0 and < 1;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions