Fix inlining of local objects. (#1920)

This commit is contained in:
Sergey Bogolepov
2018-08-24 10:30:14 +03:00
committed by GitHub
parent 076f6a7c99
commit 9b2fc6c6dd
3 changed files with 77 additions and 2 deletions
+5
View File
@@ -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()
}
}