mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
Put $assertionDisabled field into inline-site's class
The generated code is more inline with java, and we avoid the error of accessing package-private field outside of the package. However, this changes semantics a bit. Now, a user should set assertion status of inline-site's package, instead of inline function's one. #KT-28317: Fixed
This commit is contained in:
14
compiler/testData/codegen/bytecodeText/assert/jvmCrossinline.kt
vendored
Normal file
14
compiler/testData/codegen/bytecodeText/assert/jvmCrossinline.kt
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
||||
|
||||
inline fun inlineMe(crossinline c : () -> Unit) = { c() }
|
||||
|
||||
class A {
|
||||
fun inlineSite() {
|
||||
inlineMe {
|
||||
assert(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1 GETSTATIC A\$inlineSite\$\$inlined\$inlineMe\$1.\$assertionsDisabled
|
||||
21
compiler/testData/codegen/bytecodeText/assert/jvmCrossinlineAssertInLambda.kt
vendored
Normal file
21
compiler/testData/codegen/bytecodeText/assert/jvmCrossinlineAssertInLambda.kt
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
||||
|
||||
inline fun inlineMe(crossinline c : () -> Unit) = {
|
||||
assert(true)
|
||||
c()
|
||||
}
|
||||
|
||||
class A {
|
||||
fun inlineSite() {
|
||||
inlineMe { }
|
||||
}
|
||||
}
|
||||
|
||||
// inlineSite:
|
||||
// 1 GETSTATIC A\$inlineSite\$\$inlined\$inlineMe\$1.\$assertionsDisabled
|
||||
// A.<clinit>:
|
||||
// 1 LDC LA\$inlineSite\$\$inlined\$inlineMe\$1;.class\s*INVOKEVIRTUAL java/lang/Class.desiredAssertionStatus \(\)Z
|
||||
// 1 PUTSTATIC A\$inlineSite\$\$inlined\$inlineMe\$1.\$assertionsDisabled : Z
|
||||
// in declaration site and in inline site
|
||||
// 2 INVOKEVIRTUAL java/lang/Class.desiredAssertionStatus \(\)Z
|
||||
18
compiler/testData/codegen/bytecodeText/assert/jvmInline.kt
vendored
Normal file
18
compiler/testData/codegen/bytecodeText/assert/jvmInline.kt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
||||
|
||||
inline fun inlineMe() = assert(true)
|
||||
|
||||
class A {
|
||||
fun inlineSite() {
|
||||
inlineMe()
|
||||
}
|
||||
}
|
||||
|
||||
// A.inlineSite:
|
||||
// 1 GETSTATIC A.\$assertionsDisabled
|
||||
// A.<clinit>:
|
||||
// 1 LDC LA;.class\s*INVOKEVIRTUAL java/lang/Class.desiredAssertionStatus \(\)Z
|
||||
// 1 PUTSTATIC A.\$assertionsDisabled : Z
|
||||
// in declaration site and in inline site
|
||||
// 2 INVOKEVIRTUAL java/lang/Class.desiredAssertionStatus \(\)Z
|
||||
14
compiler/testData/codegen/bytecodeText/assert/jvmInlineLambda.kt
vendored
Normal file
14
compiler/testData/codegen/bytecodeText/assert/jvmInlineLambda.kt
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm
|
||||
|
||||
inline fun inlineMe(c: () -> Unit) = c()
|
||||
|
||||
class A {
|
||||
fun inlineSite() {
|
||||
inlineMe {
|
||||
assert(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1 GETSTATIC A.\$assertionsDisabled
|
||||
Reference in New Issue
Block a user