[JS IR BE] Unmute inlineClasses tests
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
interface I<T> {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
interface I<T> {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
interface I<T> {
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
inline class IC(val x: String)
|
||||
|
||||
interface I<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
interface II: I<IC>
|
||||
|
||||
class A : I<IC> {
|
||||
override fun foo() = IC("O")
|
||||
}
|
||||
|
||||
class B : II {
|
||||
override fun foo() = IC("K")
|
||||
}
|
||||
|
||||
fun box() = A().foo().x + B().foo().x
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
inline class IC(val x: Int)
|
||||
|
||||
interface I<T> {
|
||||
fun foo(t: T): T
|
||||
}
|
||||
|
||||
interface I2: I<IC>
|
||||
|
||||
open class A<T> {
|
||||
fun foo(t: T): T =
|
||||
if (t is IC)
|
||||
IC(20 + t.x) as T
|
||||
else
|
||||
t
|
||||
}
|
||||
|
||||
open class B: A<IC>()
|
||||
class C: I2, B()
|
||||
|
||||
fun box(): String {
|
||||
val ic = IC(10)
|
||||
val i: I<IC> = C()
|
||||
val i2: I2 = C()
|
||||
val a: A<IC> = C()
|
||||
val b: B = C()
|
||||
val c: C = C()
|
||||
|
||||
val fooI = i.foo(ic).x
|
||||
if (fooI != 30) return "Fail I"
|
||||
|
||||
// Test calling abstract fake override methods
|
||||
// with signature specialized by inline class
|
||||
val fooI2 = i2.foo(ic).x
|
||||
if (fooI2 != 30) return "Fail I2"
|
||||
|
||||
val fooA = a.foo(ic).x
|
||||
if (fooA != 30) return "Fail A"
|
||||
|
||||
val fooB = b.foo(ic).x
|
||||
if (fooB != 30) return "Fail B"
|
||||
|
||||
val resC = c.foo(ic).x
|
||||
if (resC != 30) return "Fail C"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
inline class IC(val x: Int)
|
||||
|
||||
abstract class A<T> {
|
||||
var t: T? = null
|
||||
final fun foo(): T = t!!
|
||||
}
|
||||
|
||||
class B: A<IC>()
|
||||
|
||||
interface I {
|
||||
fun foo(): IC
|
||||
}
|
||||
|
||||
class B2: A<IC>(), I
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val b = B()
|
||||
b.t = IC(10)
|
||||
if (b.foo() != IC(10)) return "Fail 1"
|
||||
|
||||
val b2 = B2()
|
||||
b2.t = IC(10)
|
||||
if (b2.foo() != IC(10)) return "Fail 2"
|
||||
|
||||
val b2i: I = b2
|
||||
if (b2i.foo() != IC(10)) return "Fail 3"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND: JVM_IR, JS_IR
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
interface IFoo<T : IFoo<T>> {
|
||||
fun T.foo(): String = bar()
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND: JVM_IR, JS_IR
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
interface IFoo<T : IFoo<T>> {
|
||||
fun foo(t: T): String = t.bar()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
inline class Ucn(private val i: UInt)
|
||||
|
||||
Reference in New Issue
Block a user