a5084c2f69
otherwise, it will be mapped to inline class type if underlying type is primitive of nullable. #KT-52913 Fixed
25 lines
452 B
Kotlin
Vendored
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"
|
|
} |