> From: "Brian Goetz" <brian.go...@oracle.com> > To: "Remi Forax" <fo...@univ-mlv.fr>, "amber-spec-experts" > <amber-spec-experts@openjdk.java.net> > Sent: Mercredi 8 Septembre 2021 17:08:59 > Subject: Re: merging cases in between values and types
> It doesn't really matter, since 42 is subsumed into Integer anyway. Null is > the > weirdo (as always.) ??, currently we allow null but not 42. Rémi > On 9/8/2021 2:42 AM, Remi Forax wrote: >> 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