[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:
+3
@@ -1,3 +1,6 @@
|
||||
// Enable for dexing once we have a D8 version with a fix for
|
||||
// https://issuetracker.google.com/148661132
|
||||
// IGNORE_DEXING
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
+3
@@ -1,3 +1,6 @@
|
||||
// Enable for dexing once we have a D8 version with a fix for
|
||||
// https://issuetracker.google.com/148661132
|
||||
// IGNORE_DEXING
|
||||
// FILE: 1.kt
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
package test
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
// SKIP_INLINE_CHECK_IN: lParams$default
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
// SKIP_INLINE_CHECK_IN: lParams$default
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
// SKIP_INLINE_CHECK_IN: lParams$default
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
// SKIP_INLINE_CHECK_IN: lParams$default
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
// SKIP_INLINE_CHECK_IN: lParams$default
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
|
||||
// FILE: 1.kt
|
||||
// SKIP_INLINE_CHECK_IN: lParams$default
|
||||
|
||||
|
||||
+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
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class C {
|
||||
fun `a$default`(c: C, x: Int, m: Int, mh: Any) {}
|
||||
fun a(x: Int = 1) {}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
open class Base {
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// TARGET_BACKEND: JVM_OLD
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
open class Base {
|
||||
open fun `foo$default`(d: Derived, i: Int, mask: Int, mh: Any) {}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
<!ACCIDENTAL_OVERRIDE!>fun foo(i: Int = 0)<!> {}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public open class Base {
|
||||
public constructor Base()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun `foo$default`(/*0*/ d: Derived, /*1*/ i: kotlin.Int, /*2*/ mask: kotlin.Int, /*3*/ mh: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Derived : Base {
|
||||
public constructor Derived()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ i: kotlin.Int = ...): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun `foo$default`(/*0*/ d: Derived, /*1*/ i: kotlin.Int, /*2*/ mask: kotlin.Int, /*3*/ mh: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class C {
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// TARGET_BACKEND: JVM_OLD
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class C {
|
||||
Reference in New Issue
Block a user