Expression switch exception naming

Brian Goetz brian.goetz at
Fri Mar 30 19:10:32 UTC 2018

Yes, you misunderstood :)

You would always get an exhaustiveness check.  What you'd not get is the 
"grace" of having said:

    case RED:
    case YELLOW:
    case GREEN:

without a default, and having that still be considered exhaustive 
because these are all the alternatives known at compile time.  It would 
be like today, where flow analysis sometimes requires you to have a 
default on an enum switch even though you've covered all the bases.

On 3/30/2018 3:06 PM, Mark Raynsford wrote:
> That seems rather unpleasant: If my API returns values of a sealed type
> and I expect API consumers to match on/switch on values of that type
> (consider something like Scala's Either type), it'd be very nasty if
> they didn't get exhaustiveness checks just because the consumers live
> outside of my module.
> Perhaps I've misunderstood and that wasn't what was intended?

More information about the amber-spec-experts mailing list