JVM_IR: Generate more line numbers for intrinsic comparisons.

Otherwise, if complex expressions such as when expressions are
used in combination with the intrinsics we get incorrect stepping
behavior.

^KT-64341 Fixed
This commit is contained in:
Mads Ager
2023-12-13 12:43:05 +01:00
committed by Space Cloud
parent a441a82357
commit e41a1247e2
23 changed files with 723 additions and 54 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ inline fun getB(): Int {
// test.kt:15 box
// test.kt:7 box
// test.kt:12 getA
// test.kt:7 box
// test.kt:6 box
// test.kt:9 box
// test.kt:15 box
// test.kt:9 box
+43
View File
@@ -0,0 +1,43 @@
// IGNORE_BACKEND: WASM
// FILE: test.kt
fun foo(n: Number) {
if (n.toInt() > 1 && when (n) {
is Float -> true
else -> false
}) {
}
if (when (n) {
is Float -> true
else -> false
} && n.toInt() > 1) {
}
}
fun box() {
foo(2.0f)
}
// EXPECTATIONS JVM_IR
// test.kt:18 box
// test.kt:5 foo
// test.kt:6 foo
// test.kt:5 foo
// test.kt:10 foo
// test.kt:11 foo
// test.kt:10 foo
// test.kt:13 foo
// test.kt:15 foo
// test.kt:19 box
// EXPECTATIONS JS_IR
// test.kt:18 box
// test.kt:5 foo
// test.kt:6 foo
// test.kt:6 foo
// test.kt:11 foo
// test.kt:11 foo
// test.kt:10 foo
// test.kt:13 foo
// test.kt:15 foo
// test.kt:19 box
+43
View File
@@ -0,0 +1,43 @@
// IGNORE_BACKEND: WASM
// FILE: test.kt
fun foo(n: Number) {
if (n.toInt() < 1 || when (n) {
is Float -> false
else -> true
}) {
}
if (when (n) {
is Float -> false
else -> true
} || n.toInt() > 1) {
}
}
fun box() {
foo(2.0f)
}
// EXPECTATIONS JVM_IR
// test.kt:18 box
// test.kt:5 foo
// test.kt:6 foo
// test.kt:5 foo
// test.kt:10 foo
// test.kt:11 foo
// test.kt:10 foo
// test.kt:13 foo
// test.kt:15 foo
// test.kt:19 box
// EXPECTATIONS JS_IR
// test.kt:18 box
// test.kt:5 foo
// test.kt:6 foo
// test.kt:6 foo
// test.kt:11 foo
// test.kt:11 foo
// test.kt:10 foo
// test.kt:13 foo
// test.kt:15 foo
// test.kt:19 box
@@ -0,0 +1,65 @@
// IGNORE_BACKEND: WASM
// FILE: test.kt
fun foo(n: Any, other: Any) {
if (other == when (n) {
is Int -> n
else -> 1.0f
}) {
}
if (when (n) {
is Int -> n
else -> 1.0f
} == other) {
}
if (other != when (n) {
is Int -> n
else -> 1.0f
}) {
}
if (when (n) {
is Int -> n
else -> 1.0f
} != other) {
}
}
fun box() {
foo(2, Any())
}
// EXPECTATIONS JVM_IR
// test.kt:28 box
// test.kt:5 foo
// test.kt:6 foo
// test.kt:5 foo
// test.kt:10 foo
// test.kt:11 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:16 foo
// test.kt:15 foo
// test.kt:20 foo
// test.kt:21 foo
// test.kt:23 foo
// test.kt:20 foo
// test.kt:25 foo
// test.kt:29 box
// EXPECTATIONS JS_IR
// test.kt:28 box
// test.kt:6 foo
// test.kt:6 foo
// test.kt:5 foo
// test.kt:11 foo
// test.kt:11 foo
// test.kt:10 foo
// test.kt:16 foo
// test.kt:16 foo
// test.kt:15 foo
// test.kt:21 foo
// test.kt:21 foo
// test.kt:20 foo
// test.kt:25 foo
// test.kt:29 box
+29
View File
@@ -0,0 +1,29 @@
// IGNORE_BACKEND: WASM
// FILE: test.kt
fun foo(n: Number) {
if (!when (n) {
is Float -> false
else -> true
}) {
}
}
fun box() {
foo(2.0f)
}
// EXPECTATIONS JVM_IR
// test.kt:13 box
// test.kt:5 foo
// test.kt:6 foo
// test.kt:5 foo
// test.kt:10 foo
// test.kt:14 box
// EXPECTATIONS JS_IR
// test.kt:13 box
// test.kt:6 foo
// test.kt:6 foo
// test.kt:10 foo
// test.kt:14 box
@@ -0,0 +1,39 @@
// IGNORE_BACKEND: WASM
// FILE: test.kt
fun foo(n: Number) {
if (when (n) {
is Float -> null
else -> 32
} == null) {
}
if (when (n) {
is Float -> null
else -> 32
} != null) {
}
}
fun box() {
foo(2.0f)
}
// EXPECTATIONS JVM_IR
// test.kt:18 box
// test.kt:5 foo
// test.kt:6 foo
// test.kt:5 foo
// test.kt:10 foo
// test.kt:11 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:19 box
// EXPECTATIONS JS_IR
// test.kt:18 box
// test.kt:6 foo
// test.kt:6 foo
// test.kt:11 foo
// test.kt:11 foo
// test.kt:15 foo
// test.kt:19 box
@@ -0,0 +1,41 @@
// IGNORE_BACKEND: WASM
// FILE: test.kt
fun foo(n: Any) {
if (1 == when (n) {
is Int -> n
else -> 1.0f
}) {
}
if (1 != when (n) {
is Int -> n
else -> 1.0f
}) {
}
}
fun box() {
foo(2)
}
// EXPECTATIONS JVM_IR
// test.kt:18 box
// test.kt:5 foo
// test.kt:6 foo
// test.kt:5 foo
// test.kt:10 foo
// test.kt:11 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:19 box
// EXPECTATIONS JS_IR
// test.kt:18 box
// test.kt:6 foo
// test.kt:6 foo
// test.kt:5 foo
// test.kt:11 foo
// test.kt:11 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:19 box
@@ -0,0 +1,29 @@
// IGNORE_BACKEND: WASM
// FILE: test.kt
fun foo(n: Number) {
if (when (n) {
is Float -> 1
else -> 0
} == 0) {
}
}
fun box() {
foo(2.0f)
}
// EXPECTATIONS JVM_IR
// test.kt:13 box
// test.kt:5 foo
// test.kt:6 foo
// test.kt:5 foo
// test.kt:10 foo
// test.kt:14 box
// EXPECTATIONS JS_IR
// test.kt:13 box
// test.kt:6 foo
// test.kt:6 foo
// test.kt:10 foo
// test.kt:14 box