[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.
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: test.kt
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
massert(true)
|
||||
massert(true) {
|
||||
"test"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// LINENUMBERS
|
||||
// test.kt:24
|
||||
// test.kt:15
|
||||
// test.kt:16
|
||||
// test.kt:3
|
||||
// test.kt:16
|
||||
// test.kt:17
|
||||
// test.kt:21
|
||||
// test.kt:25
|
||||
// test.kt:6
|
||||
// test.kt:3
|
||||
// test.kt:6
|
||||
// test.kt:7
|
||||
// test.kt:12
|
||||
// test.kt:29
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
// FILE: test.kt
|
||||
fun ifoo(ok: String = "OK"): String {
|
||||
return ok
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return ifoo()
|
||||
}
|
||||
|
||||
// LINENUMBERS
|
||||
// test.kt:8
|
||||
// test.kt:3
|
||||
// test.kt:4
|
||||
// test.kt:3
|
||||
// test.kt:8
|
||||
@@ -0,0 +1,15 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: test.kt
|
||||
inline fun ifoo(ok: String = "OK"): String {
|
||||
return ok
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return ifoo()
|
||||
}
|
||||
// TODO: IR Backend behaves like simpleDefaultArg: 8,3,4, _3_ ,8
|
||||
// LINENUMBERS
|
||||
// test.kt:8
|
||||
// test.kt:3
|
||||
// test.kt:4
|
||||
// test.kt:8
|
||||
@@ -0,0 +1,18 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: test.kt
|
||||
inline fun alsoInline() = "OK"
|
||||
|
||||
inline fun ifoo(s: String = alsoInline()): String {
|
||||
return s
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return ifoo()
|
||||
}
|
||||
|
||||
// LINENUMBERS
|
||||
// test.kt:10
|
||||
// test.kt:5
|
||||
// test.kt:3
|
||||
// test.kt:6
|
||||
// test.kt:10
|
||||
Reference in New Issue
Block a user