When several patterns are total ?
Remi Forax
forax at univ-mlv.fr
Sun Aug 30 11:12:28 UTC 2020
Hi,
i've hinted that there is an issue with intersection type and totality, but we did not follow up.
Here is the issue
var value = flag? "foo": 42;
switch(value) {
case String s -> ...
case Integer i -> ...
case Serializable s ->
case Comparable<?> c ->
}
given that the type of value is an intersection type Serializable & Comparable<?> & ...
the last two cases are total with respect to the type of value. which does not go well with the current semantics that can only have one total case.
Rémi
More information about the amber-spec-observers
mailing list