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.
10 lines
194 B
Kotlin
10 lines
194 B
Kotlin
fun main(args: Array<String>) {
|
|
try {
|
|
val x = cast<String>(Any())
|
|
println(x.length)
|
|
} catch (e: Throwable) {
|
|
println("Ok")
|
|
}
|
|
}
|
|
|
|
fun <T> cast(x: Any?) = x as T |