Tests for issues fixed in JVM_IR

This commit is contained in:
Dmitry Petrov
2020-12-21 15:41:21 +03:00
parent 5e5b236ef8
commit 443cd0fc2c
19 changed files with 364 additions and 1 deletions
@@ -0,0 +1,11 @@
// IGNORE_BACKEND: JVM
open class Base(val fn: () -> String)
class Test(x: String) :
Base({
class Local(val t: String = x)
Local().t
})
fun box() =
Test("OK").fn()
+16
View File
@@ -0,0 +1,16 @@
// IGNORE_BACKEND: JVM
class X(val x: String) {
open inner class Y {
fun foo() = x
}
fun foo(s: String): String {
with(X(s+x)) {
val obj = object : Y() {}
return obj.foo()
}
}
}
fun box() =
X("K").foo("O")
+22
View File
@@ -0,0 +1,22 @@
// IGNORE_BACKEND: JVM
fun <T, R> with2(receiver: T, block: T.() -> R): R {
return receiver.block()
}
class X(val x: String) {
open inner class Y {
fun foo() = x
}
fun foo(s: String): String {
var t = ""
with2(X(s+x)) {
val obj = object : Y() {}
t = obj.foo()
}
return t
}
}
fun box() =
X("K").foo("O")