Files
kotlin-fork/compiler/testData/codegen/box/inlineClasses/kt52913.kt
T
Ilmir Usmanov a5084c2f69 JVM IR: Make receiver type of IrGetField not null
otherwise, it will be mapped to inline class type if underlying type
is primitive of nullable.

 #KT-52913 Fixed
2022-06-30 01:28:09 +00:00

25 lines
452 B
Kotlin
Vendored

// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses
interface MyInterface
var value: Any? = null
fun saveValue(a: Any?) {
value = a
}
OPTIONAL_JVM_INLINE_ANNOTATION
value class MyClass(private val value: Int): MyInterface {
fun foo(other: MyInterface) {
saveValue((other as? MyClass)?.value)
}
}
fun box(): String {
val x = MyClass(5)
x.foo(x)
if (value != 5) return "FAIL: $value"
return "OK"
}