RFR: 8262889: Compiler implementation for Record Patterns [v7]
Rémi Forax
forax at openjdk.java.net
Wed May 25 13:21:04 UTC 2022
On Wed, 25 May 2022 04:20:35 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> 8262889: Compiler implementation for Record Patterns
>>
>> A first version of a patch that introduces record patterns into javac as a preview feature. For the specification, please see:
>> http://cr.openjdk.java.net/~gbierman/jep427+405/jep427+405-20220426/specs/patterns-switch-record-patterns-jls.html
>>
>> There are two notable tricky parts:
>> -in the parser, it was necessary to improve the `analyzePattern` method to handle nested/record patterns, while still keeping error recovery reasonable
>> -in the `TransPatterns`, the desugaring of the record patterns is very straightforward - effectivelly the record patterns are desugared into guards/conditions. This will likely be improved in some future version/preview
>>
>> `MatchException` has been extended to cover additional cases related to record patterns.
>
> Jan Lahoda has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 34 commits:
>
> - Merge branch 'master' into patterns-record-deconstruction3
> - Post merge fix.
> - Merge branch 'master' into patterns-record-deconstruction3
> - Fixing (non-)exhaustiveness for enum.
> - Merge branch 'type-pattern-third' into patterns-record-deconstruction3
> - Merge branch 'master' into type-patterns-third
> - Using Type.isRaw instead of checking the AST structure.
> - Exhaustiveness should accept supertypes of the specified type.
> - Renaming the features from deconstruction pattern to record pattern.
> - Fixing guards after record patterns.
> - ... and 24 more: https://git.openjdk.java.net/jdk/compare/742644e2...f49d3f0a
Yai ! champagne (at least virtual).
-------------
PR: https://git.openjdk.java.net/jdk/pull/8516
More information about the compiler-dev
mailing list