[patterns-record-deconstruction3] RFR: Fix deconstruction patterns with unconditional nested type pattern

Aggelos Biboudis duke at openjdk.java.net
Mon Apr 25 18:54:55 UTC 2022


According to the spec:


class Super {}
class Sub extends Super {}
record R(Super s) {}

public static void testRes(R r) {
    switch(r) {
       case R(Super s) -> System.out.println("a");
    }
}

testRes(new R(null)); // this should match since after resolution, the nested type pattern is transformed to an any pattern

-------------

Commit messages:
 - Address review
 - Update start_pc positions in Patterns.java
 - Fix deconstruction patterns with unconditional nested type pattern

Changes: https://git.openjdk.java.net/amber/pull/81/files
 Webrev: https://webrevs.openjdk.java.net/?repo=amber&pr=81&range=00
  Stats: 89 lines in 6 files changed: 67 ins; 3 del; 19 mod
  Patch: https://git.openjdk.java.net/amber/pull/81.diff
  Fetch: git fetch https://git.openjdk.java.net/amber pull/81/head:pull/81

PR: https://git.openjdk.java.net/amber/pull/81


More information about the amber-dev mailing list