RFR: 8300543 Compiler Implementation for Pattern Matching for switch [v2]
Jan Lahoda
jlahoda at openjdk.org
Tue Apr 18 11:47:53 UTC 2023
On Fri, 14 Apr 2023 18:30:56 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Jan Lahoda has updated the pull request incrementally with six additional commits since the last revision:
>>
>> - Fixing infinite loop where a binding pattern is replaced with a binding pattern for the same type.
>> - Reflecting review comments.
>> - Fixing exhaustiveness for unsealed supertype pattern.
>> - No need to enable features after error reported.
>> - SwitchBootstraps.typeSwitch should not initialize enum classes.
>> - A prototype of avoiding enum initialization.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 4092:
>
>> 4090: log.error(DiagnosticFlag.SOURCE_LEVEL, tree.pos(),
>> 4091: Feature.UNCONDITIONAL_PATTERN_IN_INSTANCEOF.error(this.sourceName));
>> 4092: allowUnconditionalPatternsInstanceOf = true;
>
> sorry not sure why we are doing this. Either the feature should be allowed or not right?
We normally don't produce multiple source level errors, but it is true Log does that us by itself, so no need to set the flag, fixed:
https://github.com/openjdk/jdk/pull/13074/commits/bb26b52268c25863ba358843441d4c4352f877fd
Thanks!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1169907081
More information about the compiler-dev
mailing list