Refinements for sealed types

Brian Goetz brian.goetz at oracle.com
Mon Aug 19 18:27:01 UTC 2019


>> So, given all this, we should focus all our ceremony-reduction on the 
>> case of co-declared sum types.  Which is mostly what I think I was 
>> suggesting:
>>
>>   - Infer the permits clause when all the subtypes are co-declared;
>>   - Infer “final” for leaf classes in a sum type;
>>   - Require explicitness in both sealed/non-sealed, and permits 
>> clause, in other cases.
>
> How do you know from `sealed class X {}` and the rest of its 
> compilation unit that all X's subtypes are co-declared? 

By co-declared, I mean "in the same compilation unit."




More information about the amber-spec-experts mailing list