Hi Gavin, All, In http://cr.openjdk.java.net/~gbierman/jep406/jep406-20210608/specs/patterns-switch-jls.html#jls-14.30.1, Section 14.11, I see "If a switch label has a null case label element then if the switch label also has any pattern case element labels, they must be type patterns (14.30.1)." implying that the following code:
private static void foo(Object o) { switch (o) { case null, Integer i && i > 10 -> System.out.println(0); // flag error? default -> System.out.println(o); } should have an error flagged for case label with null since the pattern case label element is not a type pattern but a guarded pattern. Any reason for excluding guarded patterns here? Or does this requires a modification in spec to include guarded patterns as well? Regards, Manoj