blob: 21f5bfd3705cf62bfa062bce3132165b06675c49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// IGNORE_BACKEND: JS
// Check that local variables for inline functions and inline default lambdas start
// after they are initialized.
inline fun spray() {
val a = Any()
val b = Any()
val c = Any()
val d = Any()
val e = Any()
}
inline fun f(block: () -> String = { "OK" }): String = block()
fun box(): String {
// On the JVM, this call adds some locals with reference types to the LVT
// which end after the call returns.
spray()
// When inlining `f` we'll reuse the same slots that previously contained
// locals with reference types for the $i$f$f and $i$a$-f-... variables.
// Since these locals have integer types D8 would produce a warning if they
// started before being initialized, which would cause the test to fail.
return f()
}
|