arekolek
05/21/2018, 2:19 PMsealed class Foo<T> : List<T>
class Ints(list: List<Int>) : Foo<Int>(), List<Int> by list
class Strings(list: List<String>) : Foo<String>(), List<String> by list
fun <T> test(x: Foo<T>): Int {
return when (x) {
is Ints -> 1
is Strings -> 2
}
}
fun main(args: Array<String>) {
println(test(Ints(emptyList())))
println(test(Strings(emptyList())))
}