-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Issue #15082:LITERAL_WHEN token should have EXPR child #15084
Conversation
c1f145e
to
f02062d
Compare
5949b3a
to
76a6b96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments:
* @throws IOException if file does not exist | ||
*/ | ||
@Test | ||
public void countExprUsagesInParserGrammar() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully we can prevent this in the future. I had considered using a custom check for this, and a few other things that included individual suppressions, but really we should not need to get this crazy. As long as we can explain why we increase the number of expected usages of the expr
rule, we should be fine. I placed a comment directly above this value so that we will notice updates to this number and catch it in review.
| | | | | | | |--ELIST -> ELIST [10:39] | ||
| | | | | | | `--RPAREN -> ) [10:39] | ||
| | | | | | `--NUM_INT -> 6 [10:43] | ||
| | | | | | `--EXPR -> EXPR [10:41] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All diffs in AST files are expected, we have just added a new EXPR
node parent to each.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concerns are being addressed in new issues.
| | | | | | `--NUM_INT -> 0 [20:43] | ||
| | | | | | `--EXPR -> EXPR [20:40] | ||
| | | | | | `--GE -> >= [20:40] | ||
| | | | | | |--IDENT -> when [20:35] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a concern and will put it in a new issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 18 to 22 in d951e08
return switch (x) { | |
// this is horrible, but it compiles | |
case Integer when when when >= 0 -> when.toString(); | |
default -> "2"; | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank a lot for the quick fix!
This PR needs laptop time. |
| | | | | | `--EXPR -> EXPR [84:44] | ||
| | | | | | `--LITERAL_INSTANCEOF -> instanceof [84:44] | ||
| | | | | | |--IDENT -> o2 [84:41] | ||
| | | | | | `--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF [84:55] | ||
| | | | | | |--MODIFIERS -> MODIFIERS [84:55] | ||
| | | | | | |--TYPE -> TYPE [84:55] | ||
| | | | | | | `--IDENT -> String [84:55] | ||
| | | | | | `--IDENT -> s [84:62] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok to merge.
Closes #15082.
Link to report workflow: https://github.com/nrmancuso/checkstyle-diff-report-generator/actions/runs/9614065671
Projects file: projects-to-test-on.properties
Patch branch: issue-15082
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/issue-15082/2024-06-21-T-15-06-41/part1/index.html
No diff.
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/issue-15082/2024-06-21-T-15-06-41/part4/index.html
We will need to explore BooleanExpressionComplexity in #15044
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/issue-15082/2024-06-21-T-15-06-41/part5/index.html
No diff
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/issue-15082/2024-06-21-T-15-06-41/part3/index.html
We will need to explore UnnecessaryParentheses in #14972, looks like we fixed some false positives and false negatives
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/issue-15082/2024-06-21-T-15-06-41/part2/index.html
No diff
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/issue-15082/2024-06-21-T-15-06-41/part6/index.html
No diff
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/issue-15082/2024-06-21-T-15-06-41/sevntu-check-regression_part_1/index.html
No diff
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/issue-15082/2024-06-21-T-15-06-41/sevntu-check-regression_part_2/index.html
No diff
https://checkstyle-reports.s3.us-east-2.amazonaws.com/reports/issue-15082/2024-06-21-T-15-06-41/antlr-report-checkstyle/index.html
All expected diffs