xii
03/04/2021, 12:54 PMxii
03/04/2021, 12:54 PMenum class Test{
a,
b,
c}
xii
03/04/2021, 12:55 PMxii
03/04/2021, 12:55 PMxii
03/04/2021, 12:55 PMRob Elliot
03/04/2021, 1:04 PMsealed interface Allowed
sealed class Test {
object a : Test(), Allowed
object b : Test(), Allowed
object c : Test()
}
fun onlyAllowed(foo: Allowed): Unit = TODO()
// compiles
onlyAllowed(Test.a)
onlyAllowed(Test.b)
// does not compile
onlyAllowed(Test.c)
Rob Elliot
03/04/2021, 1:14 PMsealed class Test {
sealed class Allowed : Test() {
object a : Allowed()
object b : Allowed()
}
object c : Test()
}
xii
03/04/2021, 2:05 PMxii
03/04/2021, 2:05 PMxii
03/04/2021, 2:07 PMRob Elliot
03/04/2021, 2:08 PM