Updated patterns-in-switch doc
Remi Forax
forax at univ-mlv.fr
Sun Sep 13 10:35:55 UTC 2020
At the end of the section "refining-totality" [1],
The sentence "Guarded patterns should be ignored entirely for purposes of computing totality." implies that if two patterns that only differ from one having a where and the other have not it's not valif to have them both in a switch seems wrong for me.
By example, a switch like this is illegal
switch(foo) {
case Bar bar where bar.x == 0 -> ...
case Bar bar -> ...
...
}
I believe that what we want is to consider that a pattern with a where clause is considered as a "subtype" of the pattern without a where clause, whatever the where clause is exactly.
Rémi
[1] https://github.com/openjdk/amber-docs/blob/master/site/design-notes/type-patterns-in-switch.md#refining-totality
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Mardi 8 Septembre 2020 18:43:01
> Objet: Updated patterns-in-switch doc
> I have updated
> [
> https://github.com/openjdk/amber-docs/blob/master/site/design-notes/type-patterns-in-switch.md
> |
> https://github.com/openjdk/amber-docs/blob/master/site/design-notes/type-patterns-in-switch.md
> ]
> based on our discussions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20200913/e2ed8667/attachment.htm>
More information about the amber-spec-experts
mailing list