merging cases in between values and types
Remi Forax
forax at univ-mlv.fr
Wed Sep 8 06:42:29 UTC 2021
Hi all,
the current spec support merging/fallthrough cases only when there is a case null,
like
case null, case Integer i -> // i can use 'i' here
First, i'm not sure it's clearly written in the spec, i was not able to pinpoint the rule allowing it.
Then i wonder if this special behavior is special because null is special or if it should work with any values of the type of the type pattern,
i.e. it works because null is a possible value of Integer, in that case, it should also work with any other values like 42
case 42, case Integer i -> // i can use 'i' here
So is null a special value or does this rule also work with any values.
regards,
Rémi
More information about the amber-spec-experts
mailing list