First, check for inline class type before boxing

The problem was that if `type` is of primitive type, but `KotlinType` is
 actually an inline class type, then anyway we boxed this type as primitive
This commit is contained in:
Mikhail Zarechenskiy
2018-07-13 11:58:41 +03:00
parent 3c71761cf3
commit 820d168607
2 changed files with 14 additions and 7 deletions
@@ -4,6 +4,7 @@
// IGNORE_BACKEND: JS_IR
inline class Foo(val arg: Int)
inline class AsAny(val arg: Any)
fun box(): String {
val arr = arrayOf(Foo(1), Foo(2))
@@ -12,5 +13,14 @@ fun box(): String {
sum += el.arg
}
return if (sum != 3) "Fail" else "OK"
if (sum != 3) return "Fail 1"
sum = 0
for (el in arrayOf(AsAny(42), AsAny(1))) {
sum += el.arg as Int
}
if (sum != 43) return "Fail 2"
return "OK"
}