65444ec690
* add initial support for casts with generics;
* optimize out the casts to subtypes
Also add tests unchecked_cast{1,2}, the latter is disabled.
16 lines
260 B
Kotlin
16 lines
260 B
Kotlin
fun main(args: Array<String>) {
|
|
foo<String>("17")
|
|
bar<String>("17")
|
|
foo<String>(42)
|
|
bar<String>(42)
|
|
}
|
|
|
|
fun <T> foo(x: Any?) {
|
|
val y = x as T
|
|
println(y.toString())
|
|
}
|
|
|
|
fun <T> bar(x: Any?) {
|
|
val y = x as? T
|
|
println(y.toString())
|
|
} |