Add more tests for type operators on the jvm

This commit is contained in:
Steven Schäfer
2019-05-22 14:42:05 +02:00
committed by max-kammerer
parent b6ea135e70
commit 6bf16a96e1
11 changed files with 99 additions and 5 deletions
@@ -2,13 +2,13 @@
// 'as?' should be generated as a single 'safeAs...' intrinsic call
// without instanceof or 'is...'.
inline fun <reified T> safeAs(x: Any) {
x as? T
inline fun <reified T> safeAs(x: Any): T? {
return x as? T
}
fun test() {
val x: Any = arrayListOf("abc", "def")
safeAs<MutableList<*>>(x)
safeAs<MutableList<*>>(x)?.clear()
}
// 0 INSTANCEOF java/util/List