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

Allow primitive types for patterns #4506

Merged

Conversation

johannescoetzee
Copy link
Contributor

Fixes #4504.

The type of a PatternExpr has been represented by a reference type until now, which was correct before the introduction of record patterns (since a top level pattern type must always be a reference type from https://docs.oracle.com/javase/specs/jls/se21/html/jls-14.html#jls-Pattern), but now nested type patterns may have a primitive type as well. The type of a record pattern expr must still be a reference type since there aren't primitive records in java.

This PR updates the type of a pattern to reflect this, which includes making a necessary API change.

Copy link

codecov bot commented Jul 22, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 57.859%. Comparing base (e1d59d3) to head (d16ccc4).
Report is 4 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##            master     #4506       +/-   ##
=============================================
+ Coverage   57.854%   57.859%   +0.004%     
=============================================
  Files          508       508               
  Lines        29773     29774        +1     
  Branches      5253      5253               
=============================================
+ Hits         17225     17227        +2     
+ Misses       10417     10416        -1     
  Partials      2131      2131               
Flag Coverage Δ
AlsoSlowTests 57.859% <50.000%> (+0.004%) ⬆️
javaparser-core 57.859% <50.000%> (+0.004%) ⬆️
javaparser-symbol-solver 57.859% <50.000%> (+0.004%) ⬆️
jdk-10 57.812% <50.000%> (+0.004%) ⬆️
jdk-11 57.825% <50.000%> (+0.004%) ⬆️
jdk-12 57.812% <50.000%> (+0.004%) ⬆️
jdk-13 57.825% <50.000%> (+0.004%) ⬆️
jdk-14 57.812% <50.000%> (+0.004%) ⬆️
jdk-15 57.825% <50.000%> (+0.004%) ⬆️
jdk-16 57.825% <50.000%> (+0.004%) ⬆️
jdk-17 57.825% <50.000%> (+0.004%) ⬆️
jdk-18 57.825% <50.000%> (+0.004%) ⬆️
jdk-8 57.828% <50.000%> (+0.004%) ⬆️
jdk-9 57.812% <50.000%> (+0.004%) ⬆️
macos-latest 57.849% <50.000%> (+0.004%) ⬆️
ubuntu-latest 57.835% <50.000%> (+0.004%) ⬆️
windows-latest 57.835% <50.000%> (+0.004%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
.../github/javaparser/ast/expr/RecordPatternExpr.java 66.666% <100.000%> (+0.564%) ⬆️
...om/github/javaparser/ast/expr/TypePatternExpr.java 50.000% <ø> (ø)
...om/github/javaparser/ast/visitor/CloneVisitor.java 39.770% <100.000%> (ø)
...thub/javaparser/metamodel/JavaParserMetaModel.java 99.703% <100.000%> (ø)
...va/com/github/javaparser/ast/expr/PatternExpr.java 50.000% <0.000%> (ø)
...github/javaparser/ast/visitor/ModifierVisitor.java 28.855% <0.000%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc14627...d16ccc4. Read the comment docs.

@jlerbsc jlerbsc merged commit c176322 into javaparser:master Jul 22, 2024
33 of 35 checks passed
@jlerbsc
Copy link
Collaborator

jlerbsc commented Jul 22, 2024

Thank you for this fix.

@jlerbsc jlerbsc added this to the next release milestone Jul 22, 2024
@jlerbsc jlerbsc added the PR: Fixed A PR that offers a fix or correction label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Fixed A PR that offers a fix or correction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ParseProblemException when parsing record pattern with primitive types
2 participants