JVM IR: (Un)mute tests and add more tests for bridge generation
This commit is contained in:
committed by
Georgy Bronnikov
parent
12e31a1760
commit
5f6af58aeb
@@ -0,0 +1,22 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
open class Base<T> {
|
||||
open fun f(x: T): String {
|
||||
return "Fail"
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Derived : Base<String>() {
|
||||
abstract override fun f(x: String): String
|
||||
}
|
||||
|
||||
class Implementation : Derived() {
|
||||
override fun f(x: String): String {
|
||||
return x
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val base = Implementation() as Base<String>
|
||||
return base.f("OK")
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
var result = "Fail"
|
||||
|
||||
interface A<T> {
|
||||
fun f(x: T) {
|
||||
result = x.toString()
|
||||
}
|
||||
}
|
||||
|
||||
abstract class B1<T> : A<T>
|
||||
|
||||
interface B2 {
|
||||
fun f(x: String)
|
||||
}
|
||||
|
||||
class C : B1<String>(), B2
|
||||
|
||||
fun box(): String {
|
||||
(C() as B2).f("OK")
|
||||
return result
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
+1
@@ -2,6 +2,7 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
|
||||
+1
@@ -2,6 +2,7 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
interface Expr {
|
||||
public fun ttFun() : Int = 12
|
||||
}
|
||||
@@ -17,4 +19,4 @@ fun box() : String {
|
||||
if (Num(11).sometest() != 11) return "fail ${Num(11).sometest()}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
inline class A(val s: String)
|
||||
|
||||
abstract class B<T, U> {
|
||||
abstract fun f(x: T, y: U): String
|
||||
}
|
||||
|
||||
open class C<T>: B<T, A>() {
|
||||
override fun f(x: T, y: A): String = y.s + " 1"
|
||||
}
|
||||
|
||||
open class D : C<A>() {
|
||||
override fun f(x: A, y: A): String = y.s + " 2"
|
||||
}
|
||||
|
||||
class E : D() {
|
||||
override fun f(x: A, y: A): String = x.s
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return E().f(A("OK"), A("Fail"))
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
inline class A(val s: String)
|
||||
|
||||
interface B<T, U> {
|
||||
fun f(x: T, y: U): String
|
||||
}
|
||||
|
||||
interface L<T> {
|
||||
fun f(x: T, y: A): String
|
||||
}
|
||||
|
||||
interface R<T> {
|
||||
fun f(x: A, y: T): String
|
||||
}
|
||||
|
||||
open class C {
|
||||
open fun f(x: A, y: A): String = y.s
|
||||
}
|
||||
|
||||
class D: C(), B<A, A>, L<A>, R<A> {
|
||||
override fun f(x: A, y: A): String = x.s
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return (D() as B<A, A>).f(A("OK"), A("Fail"))
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
inline class A(val s: String)
|
||||
|
||||
interface B<T> {
|
||||
fun f(x: T): T
|
||||
}
|
||||
|
||||
open class C {
|
||||
open fun f(x: A): A = A("OK")
|
||||
}
|
||||
|
||||
class D : C(), B<A>
|
||||
|
||||
fun box(): String {
|
||||
return (D() as B<A>).f(A("Fail")).s
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
inline class A(val s: String)
|
||||
|
||||
abstract class B<T> {
|
||||
abstract fun f(x: T): T
|
||||
}
|
||||
|
||||
class C: B<A>() {
|
||||
override fun f(x: A): A = x
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return C().f(A("OK")).s
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FILE: 1.kt
|
||||
|
||||
import testing.ClassWithInternals
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
open class SuperFoo {
|
||||
public fun bar(): String {
|
||||
if (this is Foo) {
|
||||
@@ -14,4 +16,4 @@ class Foo : SuperFoo() {
|
||||
public fun superFoo() {}
|
||||
}
|
||||
|
||||
fun box(): String = Foo().bar()
|
||||
fun box(): String = Foo().bar()
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
open class A {
|
||||
fun f(): String =
|
||||
when (this) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FILE: a.kt
|
||||
|
||||
package a
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FILE: a.kt
|
||||
|
||||
package a
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
interface AL {
|
||||
fun get(index: Int) : Any? = null
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
open class A
|
||||
|
||||
class B : A() {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
interface A<T> {
|
||||
fun f(x: T): T
|
||||
}
|
||||
|
||||
open class B {
|
||||
open fun f(x: String): String = x
|
||||
}
|
||||
|
||||
open class C : B(), A<String>
|
||||
|
||||
class D : C()
|
||||
|
||||
fun box(): String {
|
||||
return (D() as A<String>).f("OK")
|
||||
}
|
||||
|
||||
// class D should not have an additional bridge
|
||||
// 1 public synthetic bridge f\(Ljava/lang/Object;\)Ljava/lang/Object;
|
||||
// 1 bridge
|
||||
Reference in New Issue
Block a user