Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

unnecessary_parenthesis: parenthesized pattern precedence (WIP) #4075

Closed
wants to merge 4 commits into from

Conversation

pq
Copy link
Contributor

@pq pq commented Feb 15, 2023

@coveralls
Copy link

coveralls commented Feb 15, 2023

Coverage Status

Coverage: 95.676% (+0.003%) from 95.673% when pulling de31be5 on unnecessary_parenthesis_pattern_tests into d8cbbd7 on main.

@override
void visitParenthesizedPattern(ParenthesizedPattern node) {
var parent = node.parent;
if (parent is DartPattern && parent.precedence < node.precedence) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good.

We should explore whether we want to flag any use of a parenthesized pattern where the parent isn't another pattern. Seems like that would be a good case, but I'm not familiar enough with the patterns feature to know for sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nor am I. I'll do a little digging. Thanks!

@srawlins srawlins marked this pull request as draft April 18, 2023 19:49
@pq
Copy link
Contributor Author

pq commented Aug 14, 2023

This needs a more thorough revisit. Closing for now.

@pq pq closed this Aug 14, 2023
@kevmoo kevmoo deleted the unnecessary_parenthesis_pattern_tests branch June 25, 2024 18:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants