Generate as check for inline classes using wrapper

Should be improved when inline class is based on non-null reference
This commit is contained in:
Mikhail Zarechenskiy
2018-02-12 05:07:59 +03:00
parent a88dbefcd9
commit 6687751cf5
8 changed files with 75 additions and 9 deletions
@@ -0,0 +1,17 @@
// !LANGUAGE: +InlineClasses
inline class UInt(val u: Int)
fun test(a1: Any, a2: UInt?, a3: Any?, a4: Any?) {
val b1 = a1 as UInt // checkcast, unbox
val b2 = a2 as UInt // unbox
val b3 = a3 as UInt? // checkcast
val b4 = a4 as? UInt // instanceof, checkcast
}
// 3 CHECKCAST UInt
// 2 INVOKEVIRTUAL UInt.unbox
// 1 INSTANCEOF UInt
// 0 intValue