Enabling sealed traits across different files with union type desugaring

Of the two, I think permits would be much less cryptic:

sealed[Bar, Baz.type] trait Foo
case class OtherFoo() extends Foo

sealed trait Foo permits Bar, Baz.type
case class OtherFoo() extends Foo

If something more analogous to extends x with y is desirable, permits x and y seems like it would also be reasonable:

sealed trait Foo 
  permits Bar and Baz.type
  extends Product with Serializable

case class OtherFoo() extends Foo
1 Like