Fix mapping of platform inline class types
For the inline class: ``` inline class IC(val x: Int) ``` Type (IC..IC?) should be mapped to the wrapper `IC` because it can hold object and also because it does so for primitives #KT-28983 Fixed
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// WITH_REFLECT
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import java.util.Arrays
|
||||
|
||||
fun box(): String {
|
||||
val a0 = AtomicReference(0.toUByte()).get().javaClass
|
||||
val a1 = AtomicReference(0u).get().javaClass
|
||||
|
||||
val b = Arrays.asList(42u).first().javaClass
|
||||
|
||||
if (a0.toString() != "class kotlin.UByte") return "Fail 1"
|
||||
if (a1.toString() != "class kotlin.UInt") return "Fail 2"
|
||||
if (b.toString() != "class kotlin.UInt") return "Fail 3"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
// FILE: JavaClass.java
|
||||
|
||||
public class JavaClass {
|
||||
public static <T> T id(T x) { return x; }
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
inline class IcInt(val i: Int)
|
||||
inline class IcLong(val l: Long)
|
||||
inline class IcAny(val a: Any?)
|
||||
inline class IcOverIc(val o: IcInt)
|
||||
|
||||
fun box(): String {
|
||||
val i = IcInt(1)
|
||||
val l = IcLong(2)
|
||||
val a = IcAny("string")
|
||||
val o = IcOverIc(IcInt(3))
|
||||
|
||||
val ij = JavaClass.id(i)
|
||||
val lj = JavaClass.id(l)
|
||||
val aj = JavaClass.id(a)
|
||||
val oj = JavaClass.id(o)
|
||||
|
||||
if (ij.i != 1) return "Fail 1"
|
||||
if (lj.l != 2L) return "Fail 2"
|
||||
if (aj.a != "string") return "Fail 3"
|
||||
if (oj.o.i != 3) return "Fail 4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user