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" <[email protected]>
> À: "amber-spec-experts" <[email protected]>
> 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.