Fix bridge methods generation when inline class types are used
This commit is contained in:
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
inline class InlinedComparable(val x: Int) : Comparable<InlinedComparable> {
|
||||
override fun compareTo(other: InlinedComparable): Int {
|
||||
return x.compareTo(other.x)
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> generic(c: Comparable<T>, element: T) = c.compareTo(element)
|
||||
|
||||
interface Base<T> {
|
||||
fun Base<T>.foo(a: Base<T>, b: T): Base<T>
|
||||
}
|
||||
|
||||
inline class InlinedBase(val x: Int) : Base<InlinedBase> {
|
||||
override fun Base<InlinedBase>.foo(a: Base<InlinedBase>, b: InlinedBase): Base<InlinedBase> {
|
||||
return if (a is InlinedBase) InlinedBase(a.x + b.x) else this
|
||||
}
|
||||
|
||||
fun double(): InlinedBase {
|
||||
return this.foo(this, this) as InlinedBase
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = InlinedComparable(42)
|
||||
if (generic(a, a) != 0) return "Fail 1"
|
||||
|
||||
val b = InlinedBase(3)
|
||||
if (b.double().x != 6) return "Fail 2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -13,6 +13,10 @@ inline class MyUIntArray(private val storage: IntArray) : Collection<MyUInt> {
|
||||
override fun isEmpty(): Boolean = TODO()
|
||||
}
|
||||
|
||||
fun <T> checkBoxed(c: Collection<T>, element: T): Boolean {
|
||||
return c.contains(element) && c.containsAll(listOf(element))
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val uints = MyUIntArray(intArrayOf(0, 1, 42))
|
||||
|
||||
@@ -21,5 +25,7 @@ fun box(): String {
|
||||
val ints = listOf(MyUInt(1), MyUInt(0))
|
||||
if (!uints.containsAll(ints)) return "Fail 2"
|
||||
|
||||
if (!checkBoxed(uints, MyUInt(0))) return "Fail 3"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user