Fix inlining of local objects. (#1920)
This commit is contained in:
@@ -2526,6 +2526,11 @@ task inline_defaultArgs(type: RunKonanTest) {
|
||||
source = "codegen/inline/defaultArgs.kt"
|
||||
}
|
||||
|
||||
task inline_twiceInlinedObject(type: RunKonanTest) {
|
||||
goldValue = "Ok\n"
|
||||
source = "codegen/inline/twiceInlinedObject.kt"
|
||||
}
|
||||
|
||||
task classDeclarationInsideInline(type: RunKonanTest) {
|
||||
source = "codegen/inline/classDeclarationInsideInline.kt"
|
||||
goldValue = "test1: 1.0\n1\ntest2\n"
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package codegen.inline.twiceInlinedObject
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
inline fun exec(f: () -> Unit) = f()
|
||||
|
||||
inline fun test2() {
|
||||
val obj = object {
|
||||
fun sayOk() = println("Ok")
|
||||
}
|
||||
obj.sayOk()
|
||||
}
|
||||
|
||||
inline fun noExec(f: () -> Unit) { }
|
||||
|
||||
@Test fun runTest() {
|
||||
exec {
|
||||
test2()
|
||||
}
|
||||
noExec {
|
||||
test2()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user