RFR: 8262889: Compiler implementation for Record Patterns

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu May 5 15:48:38 UTC 2022


On Thu, 5 May 2022 12:28:42 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>>> I think this is i) from the domination relation:
>>> 
>>> > A record pattern with type R and record component pattern list L dominates another record pattern with type S and record component pattern list M if (i) the erasure of S is a subtype of the erasure of R, and (ii) every pattern, if any, in L dominates the corresponding pattern in M.
>> 
>> But this subtyping test seems to happen at the level of the component pattern list, not at the R/S level, right?
>
> You are right. It is the ii) which iteratively checks the component pattern list L.

I now believe that the check is needed to properly classify patterns based on the type of the i-th component. That said, not sure this should be a subtyping check, or a type equality

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

PR: https://git.openjdk.java.net/jdk/pull/8516


More information about the compiler-dev mailing list