RFR: 8262889: Compiler implementation for Record Patterns [v3]
Jan Lahoda
jlahoda at openjdk.java.net
Sat May 7 12:03:04 UTC 2022
> 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 incrementally with two additional commits since the last revision:
- Fixing guards after record patterns.
- Raw types are not allowed in record patterns.
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/8516/files
- new: https://git.openjdk.java.net/jdk/pull/8516/files/90b37c3a..0e384fb3
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8516&range=02
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8516&range=01-02
Stats: 191 lines in 11 files changed: 157 ins; 22 del; 12 mod
Patch: https://git.openjdk.java.net/jdk/pull/8516.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8516/head:pull/8516
PR: https://git.openjdk.java.net/jdk/pull/8516
More information about the compiler-dev
mailing list