thanksforallthefish
07/09/2024, 6:23 AMelse
in this when
? and please, elaborate on the "type erasure" answer 😄
sealed interface Test
class Test1: Test
class Test2: Test
fun <T: Test> T.call() = when (this) {
is Test1 -> Unit
is Test2 -> Unit
else -> throw IllegalArgumentException("why?")
}
Thanks 🙂Joffrey
07/09/2024, 7:04 AMthanksforallthefish
07/09/2024, 7:07 AMYoussef Shoaib [MOD]
07/09/2024, 1:23 PMwhen (this as Test)
It will work then I believe!thanksforallthefish
07/09/2024, 1:25 PM