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
This commit is contained in:
Ilmir Usmanov
2022-06-27 03:13:33 +02:00
committed by Space
parent cb1a8bd687
commit a5084c2f69
10 changed files with 78 additions and 2 deletions
+25
View File
@@ -0,0 +1,25 @@
// 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"
}