On Fri, 21 Apr 2023 15:16:03 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> Jan Lahoda has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Replacing use of mutable callsite with a mutable state. > > src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java line 915: > >> 913: */ >> 914: private List<PatternDescription> reduceBindingPatterns(Type >> selectorType, List<PatternDescription> patterns) { >> 915: Set<Symbol> existingBindings = patterns.stream() > > Playing some more - I found this example: > > > class Test { > sealed interface I permits C, D { } > non-sealed interface C extends I { } > non-sealed interface D extends I { } > > interface F { } > > <Z extends I & F> int test(Z o) { > return switch (o) { > case C c -> 1; > case D d -> 2; > }; > } > } > > > Which compiles correctly, but it doesn't look exhaustive to me (because of F) > ? Also, surprisingly, if I make C and D classes (instead of interfaces): class Test { sealed interface I permits C, D { } final class C implements I { } final class D implements I { } interface F { } <Z extends I & F> int test(Z o) { return switch (o) { case C c -> 1; case D d -> 2; }; } } I get errors like: Foo.java:10: error: incompatible types: Z cannot be converted to Test.C case C c -> 1; ^ where Z is a type-variable: Z extends I,F declared in method <Z>test(Z) Which seems odd? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1173898106