Skip to content

Commit 9fa1614

Browse files
madsagermax-kammerer
authored andcommitted
[JVM] Port line number tests to stepping framework.
Allow specifying JVM and JVM_IR as well as shared expectations. Add the method name to the step. Discard steps in synthetic methods.
1 parent 4dbd4a5 commit 9fa1614

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+896
-540
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//FILE: test.kt
1+
// FILE: test.kt
22
fun cond() = false
33

44
fun box() {
@@ -9,8 +9,8 @@ fun box() {
99
}
1010

1111
// LINENUMBERS
12-
// test.kt:5
13-
// test.kt:2
14-
// test.kt:5
15-
// test.kt:8
16-
// test.kt:9
12+
// test.kt:5 box
13+
// test.kt:2 cond
14+
// test.kt:5 box
15+
// test.kt:8 box
16+
// test.kt:9 box
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// FILE: test.kt
2+
3+
fun box() {
4+
{
5+
"OK"
6+
}()
7+
}
8+
9+
// LINENUMBERS
10+
// test.kt:4 box
11+
// test.kt:5 invoke
12+
// test.kt:4 box
13+
// test.kt:7 box

compiler/testData/debug/stepping/assertion.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ fun box(): String {
3030
}
3131

3232
// LINENUMBERS
33-
// test.kt:24
34-
// test.kt:15
35-
// test.kt:16
36-
// test.kt:3
37-
// test.kt:16
38-
// test.kt:17
39-
// test.kt:21
40-
// test.kt:25
41-
// test.kt:6
42-
// test.kt:3
43-
// test.kt:6
44-
// test.kt:7
45-
// test.kt:12
46-
// test.kt:29
33+
// test.kt:24 box
34+
// test.kt:15 box
35+
// test.kt:16 box
36+
// test.kt:3 getMASSERTIONS_ENABLED
37+
// test.kt:16 box
38+
// test.kt:17 box
39+
// test.kt:21 box
40+
// test.kt:25 box
41+
// test.kt:6 box
42+
// test.kt:3 getMASSERTIONS_ENABLED
43+
// test.kt:6 box
44+
// test.kt:7 box
45+
// test.kt:12 box
46+
// test.kt:29 box

compiler/testData/debug/stepping/callableReference.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ fun f(block: () -> Unit) {
1111
}
1212

1313
// LINENUMBERS
14-
// test.kt:3
15-
// test.kt:4
16-
// test.kt:10
17-
// test.kt:5
18-
// test.kt:6
19-
// test.kt:-1
20-
// test.kt:-1
21-
// test.kt:10
22-
// test.kt:11
23-
// test.kt:7
14+
// test.kt:3 box
15+
// test.kt:4 box
16+
// test.kt:10 f
17+
// test.kt:5 invoke
18+
// test.kt:6 invoke
19+
// test.kt:10 f
20+
// test.kt:11 f
21+
// test.kt:7 box
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// FILE: test.kt
2+
3+
class A {
4+
val prop = 1
5+
6+
fun foo() {
7+
prop
8+
}
9+
}
10+
11+
fun box() {
12+
val a = A()
13+
a.prop
14+
a.foo()
15+
}
16+
17+
// TODO: The JVM_IR backend has an extra line number on the return. This causes line
18+
// three to be hit both on entry to the constructor and on exit after storing the
19+
// value of prop.
20+
21+
// LINENUMBERS
22+
// test.kt:12 box
23+
// test.kt:3 <init>
24+
// test.kt:4 <init>
25+
// LINENUMBERS JVM_IR
26+
// test.kt:3 <init>
27+
// LINENUMBERS
28+
// test.kt:12 box
29+
// test.kt:13 box
30+
// test.kt:4 getProp
31+
// test.kt:13 box
32+
// test.kt:14 box
33+
// test.kt:7 foo
34+
// test.kt:8 foo
35+
// test.kt:15 box
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// FILE: test.kt
2+
3+
class A {
4+
companion object {
5+
val prop0 = 1
6+
val prop1 = 2
7+
fun foo(): Int {
8+
return prop0 + prop1
9+
}
10+
}
11+
}
12+
13+
fun box() {
14+
A.prop0
15+
A.prop1
16+
A.foo()
17+
}
18+
19+
// The JVM version hits get getProp line numbers twice. That appears
20+
// to be because the synthetic accessibility bridges (access$getProp0$cp)
21+
// have line numbers (of the start of the surrounding class) in the JVM
22+
// version and they do not have line numbers in the JVM_IR version.
23+
24+
// LINENUMBERS
25+
// test.kt:14 box
26+
// test.kt:5 getProp0
27+
// LINENUMBERS JVM
28+
// test.kt:5 getProp0
29+
// LINENUMBERS
30+
// test.kt:14 box
31+
// test.kt:15 box
32+
// test.kt:6 getProp1
33+
// LINENUMBERS JVM
34+
// test.kt:6 getProp1
35+
// LINENUMBERS
36+
// test.kt:15 box
37+
// test.kt:16 box
38+
// test.kt:8 foo
39+
// test.kt:5 getProp0
40+
// LINENUMBERS JVM
41+
// test.kt:5 getProp0
42+
// LINENUMBERS
43+
// test.kt:8 foo
44+
// test.kt:6 getProp1
45+
// LINENUMBERS JVM
46+
// test.kt:6 getProp1
47+
// LINENUMBERS
48+
// test.kt:8 foo
49+
// test.kt:16 box
50+
// test.kt:17 box
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//FILE: test.kt
1+
// FILE: test.kt
22
fun box() {
33
val k = if (getA()
44
&& getB()
@@ -19,15 +19,15 @@ fun getC() = false
1919
fun getD() = true
2020

2121
// LINENUMBERS
22-
// test.kt:3
23-
// test.kt:13
24-
// test.kt:3
25-
// test.kt:4
26-
// test.kt:15
27-
// test.kt:4
28-
// test.kt:5
29-
// test.kt:17
30-
// test.kt:5
31-
// test.kt:9
32-
// test.kt:3
33-
// test.kt:11
22+
// test.kt:3 box
23+
// test.kt:13 getA
24+
// test.kt:3 box
25+
// test.kt:4 box
26+
// test.kt:15 getB
27+
// test.kt:4 box
28+
// test.kt:5 box
29+
// test.kt:17 getC
30+
// test.kt:5 box
31+
// test.kt:9 box
32+
// test.kt:3 box
33+
// test.kt:11 box
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// FILE: test.kt
2+
3+
class A {
4+
fun computeParam() = 32
5+
6+
fun foo(param: Int = computeParam()) {
7+
}
8+
}
9+
10+
fun box() {
11+
A().foo()
12+
}
13+
14+
// FORCE_STEP_INTO
15+
// LINENUMBERS
16+
// test.kt:11 box
17+
// test.kt:3 <init>
18+
// test.kt:11 box
19+
// test.kt:6 foo$default (synthetic)
20+
// test.kt:4 computeParam
21+
// test.kt:6 foo$default (synthetic)
22+
// test.kt:7 foo
23+
// test.kt:6 foo$default (synthetic)
24+
// test.kt:12 box
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// FILE: test.kt
2+
3+
enum class E {
4+
E1;
5+
6+
fun foo() = {
7+
prop
8+
}
9+
10+
val prop = 22
11+
}
12+
13+
fun box() {
14+
E.E1.foo()
15+
}
16+
17+
// LINENUMBERS
18+
// test.kt:14 box
19+
// test.kt:6 foo
20+
// test.kt:8 foo
21+
// test.kt:14 box
22+
// test.kt:15 box
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//FILE: test.kt
1+
// FILE: test.kt
22
fun box() {
33
for (i in 1..3) {
44
foo(i)
@@ -8,14 +8,14 @@ fun box() {
88
inline fun foo(n: Int) {}
99

1010
// LINENUMBERS
11-
// test.kt:3
12-
// test.kt:4
13-
// test.kt:8
14-
// test.kt:3
15-
// test.kt:4
16-
// test.kt:8
17-
// test.kt:3
18-
// test.kt:4
19-
// test.kt:8
20-
// test.kt:3
21-
// test.kt:6
11+
// test.kt:3 box
12+
// test.kt:4 box
13+
// test.kt:8 box
14+
// test.kt:3 box
15+
// test.kt:4 box
16+
// test.kt:8 box
17+
// test.kt:3 box
18+
// test.kt:4 box
19+
// test.kt:8 box
20+
// test.kt:3 box
21+
// test.kt:6 box

compiler/testData/debug/stepping/functionInAnotherFile.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//FILE: foo.kt
1+
// FILE: foo.kt
22
import bar
33
fun foo(x: Int): Int {
44
if (x >= 0) { // 4
@@ -21,15 +21,15 @@ fun bar(x: Int) =
2121
}
2222

2323
// LINENUMBERS
24-
// test.kt:4
25-
// foo.kt:4
26-
// foo.kt:7
27-
// test.kt:8
28-
// test.kt:9
29-
// foo.kt:4
30-
// foo.kt:5
31-
// test.kt:9
32-
// test.kt:12
33-
// foo.kt:7
34-
// test.kt:4
35-
// test.kt:5
24+
// test.kt:4 box
25+
// foo.kt:4 foo
26+
// foo.kt:7 foo
27+
// test.kt:8 bar
28+
// test.kt:9 bar
29+
// foo.kt:4 foo
30+
// foo.kt:5 foo
31+
// test.kt:9 bar
32+
// test.kt:12 bar
33+
// foo.kt:7 foo
34+
// test.kt:4 box
35+
// test.kt:5 box
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//FILE: test.kt
1+
// FILE: test.kt
22
fun box(): Int {
33
if (
44
getB() ==
@@ -14,11 +14,11 @@ inline fun getB(): Int {
1414
}
1515

1616
// LINENUMBERS
17-
// test.kt:4
18-
// test.kt:13
19-
// test.kt:5
20-
// test.kt:10
21-
// test.kt:5
22-
// test.kt:7
23-
// test.kt:13
24-
// test.kt:7
17+
// test.kt:4 box
18+
// test.kt:13 box
19+
// test.kt:5 box
20+
// test.kt:10 getA
21+
// test.kt:5 box
22+
// test.kt:7 box
23+
// test.kt:13 box
24+
// test.kt:7 box
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// FILE: test.kt
2+
3+
fun foo(x: Int) {
4+
if (x > 0) {
5+
"OK"
6+
}
7+
8+
if (x > 0) else {
9+
"OK"
10+
}
11+
12+
if (x > 0) {
13+
"OK"
14+
} else {
15+
"ALSO OK"
16+
}
17+
}
18+
19+
fun box() {
20+
foo(1)
21+
foo(0)
22+
}
23+
24+
// LINENUMBERS
25+
// test.kt:20 box
26+
// test.kt:4 foo
27+
// test.kt:5 foo
28+
// test.kt:8 foo
29+
// test.kt:12 foo
30+
// test.kt:13 foo
31+
// test.kt:17 foo
32+
// test.kt:21 box
33+
// test.kt:4 foo
34+
// test.kt:8 foo
35+
// test.kt:9 foo
36+
// test.kt:12 foo
37+
// test.kt:15 foo
38+
// test.kt:17 foo
39+
// test.kt:22 box

0 commit comments

Comments
 (0)