Files
kotlin-fork/compiler/testData/codegen/boxInline/smap/assertion.kt
T
Mads Ager 03fb49bb38 [JVM_IR] Improve debugging behavior of inline functions
Specifically, this commit improves the stepping behavior of the IR
backend around functions with defaults.

  - Improved line numbers in the default handler itself for better
    stepping when inlined.

  - Improved source information on default arguments

  - Improved test coverage of stepping behavior in old and IR backends.

Improves the stepping behaviour around inline methods with default
arguments. In particular, we now accurately step through the
evaluation of default arguments, but do _not_ spuriously show the exit
from the $default handler.
2020-04-07 16:52:45 +02:00

75 lines
930 B
Kotlin
Vendored

// FILE: 1.kt
package test
public val MASSERTIONS_ENABLED: Boolean = true
public inline fun massert(value: Boolean, lazyMessage: () -> String) {
if (MASSERTIONS_ENABLED) {
if (!value) {
val message = lazyMessage()
throw AssertionError(message)
}
}
}
public inline fun massert(value: Boolean, message: Any = "Assertion failed") {
if (MASSERTIONS_ENABLED) {
if (!value) {
throw AssertionError(message)
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
massert(true)
massert(true) {
"test"
}
return "OK"
}
// FILE: 1.smap
//TODO maybe do smth with default method body mapping
SMAP
1.kt
Kotlin
*S Kotlin
*F
+ 1 1.kt
test/_1Kt
*L
1#1,26:1
*E
// FILE: 2.smap
SMAP
2.kt
Kotlin
*S Kotlin
*F
+ 1 2.kt
_2Kt
+ 2 1.kt
test/_1Kt
*L
1#1,14:1
18#2,7:15
9#2,7:22
*E
*S KotlinDebug
*F
+ 1 2.kt
_2Kt
*L
6#1,7:15
7#1,7:22
*E