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

False positive and false negative in unnecessary_parentheses #5112

Open
bwilkerson opened this issue Oct 23, 2024 · 0 comments
Open

False positive and false negative in unnecessary_parentheses #5112

bwilkerson opened this issue Oct 23, 2024 · 0 comments
Labels
false-negative false-positive P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@bwilkerson
Copy link
Member

I created one issue instead of true because these might be related. It almost looks like a condition is reversed.

I believe the lint should produce a diagnostic for the following code, but does not.

class C {
  void m() {
    (1 + 2);
  }
}

removing the parentheses does not change the semantics of the code.

On the other hand, the lint should not produce a diagnostic for the following code, but does.

class C {
  void m() {
    ({1, 2, 3});
  }
}

removing the parentheses here causes the set literal to be interpreted as a block.

@srawlins srawlins added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P3 A lower priority bug or feature request labels Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-negative false-positive P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants