Files
kotlin-fork/compiler/testData/diagnostics/testsWithJvmBackend/suspendInlineCycle.kt
T
pyos 72b80ef158 Detect inline cycles faster
E.g. in the following code

    fun x() {}
    inline fun f() { x(); g() }
    inline fun g() { x(); f() }

the old implementation of inline cycle detection bailed out after
generating 3 calls of x() in each function, while the new one stops
after 2. In other words, code generation for a single function is no
longer reentered.
2020-03-19 08:13:19 +01:00

11 lines
428 B
Kotlin
Vendored

// !RENDER_DIAGNOSTICS_FULL_TEXT
// Note: 4 diagnostics per call because there are 2 synthetic $$forInline methods.
suspend inline fun inlineFun1(p: () -> Unit) {
p()
<!INLINE_CALL_CYCLE, INLINE_CALL_CYCLE, INLINE_CALL_CYCLE, INLINE_CALL_CYCLE!>inlineFun2(p)<!>
}
suspend inline fun inlineFun2(p: () -> Unit) {
p()
<!INLINE_CALL_CYCLE, INLINE_CALL_CYCLE, INLINE_CALL_CYCLE, INLINE_CALL_CYCLE!>inlineFun1(p)<!>
}