Added some tests on local classes in inline bodies
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_IR
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline fun <T> myRun(block: () -> T) = block()
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
interface IFoo {
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
class A(val x: String, f: () -> IFoo = {
|
||||
val y = "K"
|
||||
myRun {
|
||||
val o = object: IFoo {
|
||||
override fun foo() = x + y
|
||||
}
|
||||
o
|
||||
}
|
||||
}) {
|
||||
val foo: IFoo = f()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A("O").foo.foo()
|
||||
}
|
||||
Reference in New Issue
Block a user