On Tue, 18 Apr 2023 09:13:01 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:
>> This is the first draft of a patch for JEP 440 and JEP 441. Changes included: >> >> - the pattern matching for switch and record patterns features are made >> final, together with updates to tests. >> - parenthesized patterns are removed. >> - qualified enum constants are supported for case labels. >> >> This change herein also includes removal record patterns in for each loop, >> which may be split into a separate PR in the future. > > 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 201: > 199: /** Are unconditional patterns in instanceof allowed > 200: */ > 201: private boolean allowUnconditionalPatternsInstanceOf; so I guess this field can be made final now src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java line 909: > 907: > 908: Set<Symbol> permitted = > allPermittedSubTypes(clazz, csym -> { > 909: Type instantiated = > infer.instantiatePatternType(selectorType, csym); for some cases, when there are no type parameters, this invocation is a no-op, do we really need inference at this point? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1171830887 PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1171936405