sealed class T { object A : T() object B : T() object C : T() object D : T() } fun m(t : T) : Int = when (t) { is A | B | C -> 0 is D -> 1 }