Files
kotlin-fork/compiler/testData/codegen/boxInline/assert/jvmInlineUsedAsNoinline.kt
T
pyos 847e287bd6 JVM_IR: add $assertionsDisabled when an inlined function uses it
NOTE: jvmCrossinlineLambdaDeclarationSite.kt is muted because the
inliner does not remap references to an anonymous object's parent
class after regenerating it. Unlike the JVM backend, JVM_IR uses the
top level named class' assertion status for all inner classes. (The
test used to pass because the lambda in `inline fun call` read the
`$assertionsDisabled` field of `CrossinlineLambdaContainer`, which
was not reloaded after changing the assertion status of package `test`.)
2019-10-21 21:05:18 +03:00

28 lines
580 B
Kotlin
Vendored

// Not a multi-module test.
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_IR
// FILE: A.kt
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
// WITH_RUNTIME
// FULL_JDK
class A {
inline fun inlineMe(crossinline c : () -> String) = {
assert(true)
c()
}
}
// FILE: B.java
import kotlin.jvm.functions.Function0;
public class B {
public static String check() {
return new A().inlineMe(new Function0<String>() {
@Override public String invoke() { return "OK"; }
}).invoke();
}
}
// FILE: box.kt
fun box(): String = B.check()