expression type A is a subtype of pattern type B diagnostics
Archie Cobbs
archie.cobbs at gmail.com
Tue Apr 1 17:04:38 UTC 2025
On Tue, Apr 1, 2025 at 11:49 AM Liam Miller-Cushon <cushon at google.com>
wrote:
> So all of this seems deliberate and working as intended, I was just
> curious what the rationale for the change was. Does anyone remember the
> history or have pointers to discussions about it on list?
>
I don't know what the stated rationale was at the time, but the change
makes intuitive sense to me now: Why should "e instanceof Y x" generate an
error when "e instanceof Y" does not? That is to say: the correctness of
the type test itself, which is what the error is about, has nothing to do
with whether or not you happen to be declaring a new variable that captures
a successful outcome of that test.
-Archie
--
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20250401/c34a84b4/attachment-0001.htm>
More information about the compiler-dev
mailing list