I just learned that Kotlin supports generic intersection types with the where
keyword as in:
interface TwoPhase
interface Ac120V
fun <T> foo(ac: T) where T : TwoPhase, T: Ac120V {
// do stuff...
}
Now I’m wondering if you can make a typealias for an intersection (or union) type? I don’t know. I expected to be able to do something like:
typealias Not3Phase = <T> where T : TwoPhase, T: Ac120V
or
typealias Not3Phase = TwoPhase & Ac120V
If there’s a way to do this, it’s not obvious to me.