RFR: 8339296: Record deconstruction pattern in switch fails to compile
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Sep 27 13:38:37 UTC 2024
On Fri, 27 Sep 2024 12:21:06 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java line 2424:
>>
>>> 2422: }
>>> 2423:
>>> 2424: @Override @DefinedBy(Api.LANGUAGE_MODEL)
>>
>> Modelling-wise, I'm not sure. It almost seems as if `UnknownType` should be subclassed by `ErrorType` and not the other way around. Is there a specific reason you went for this?
>
> I would see the `UnknownType` as a specific kind of an erroneous type (and hence `UnknownType` being a subtype or erroneous, as it is here).
>
> But, even from a practical point of view - `ErrorType` basically must extend `ClassType`, I think, so implanting `UnknownType` in there seems difficult.
I guess I'm a bit surprised by the typeKind - which is OTHER (you added the override to keep compatibility with what was there before). In that sense, it doesn't seem like `UnknownType` "is a" `ErrorType`, because its tag seems "less general" than the one in `ErrorType`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20990#discussion_r1778644189
More information about the compiler-dev
mailing list