File tree Expand file tree Collapse file tree 6 files changed +87
-0
lines changed Expand file tree Collapse file tree 6 files changed +87
-0
lines changed Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]): Unit = {
3
+ val b = 8 * 9 // [break] [step: f()]
4
+ f() // [step: val a]
5
+ 20 + b
6
+ print(b)
7
+ }
8
+
9
+ def f (): Unit = {
10
+ val a = for (i <- 1 to 5 ; j <- 10 to 20 ) // [cont]
11
+ yield (i, j) // Error: incorrect reaching this line
12
+
13
+ for (i <- 1 to 5 ; j <- 10 to 20 )
14
+ println(i + j) // TODO: i is renamed to i$2 --> reduce debuggability
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]): Unit = {
3
+ val a = 1 + 2
4
+ val b = a * 9 // [break] [step: plus] [step: c = plus]
5
+ val plus = (x : Int , y : Int ) => { // [cont: x * x]
6
+ val a = x * x // [break] [step: y * y]
7
+ val b = y * y // [step: a + b]
8
+ a + b // [next] [next]
9
+ }
10
+ val c = plus(a, b) // [next: print]
11
+ print(c) // [cont]
12
+ }
13
+
14
+ }
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]): Unit = {
3
+ val a = 1 + 2 // [break] [step: a * 9]
4
+ val b = a * 9 // [step: plus]
5
+ val c = plus(a, b) // [step: x * x]
6
+ print(c)
7
+ }
8
+
9
+ def plus (x : Int , y : Int ) = {
10
+ val a = x * x // [step: y * y]
11
+ val b = y * y // [step: a + b]
12
+ a + b // [step: plus] [step: print] [cont]
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]): Unit = {
3
+ val a = 1 + 2 // [break] [step: a * 9]
4
+ val b = a * 9 // [step: plus] [step: x * x]
5
+
6
+ def plus (x : Int , y : Int ) = {
7
+ val a = x * x // [step: y * y]
8
+ val b = y * y // [step: a + b]
9
+ a + b // [step: plus]
10
+ }
11
+
12
+ val c = plus(a, b) // [step: print] [cont]
13
+ print(c)
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]): Unit = {
3
+ var a = 1 + 2 // [break] [step: a + 3]
4
+ a = a + 3 // [step: 4 + 5]
5
+ a = 4 + 5 // [step: a * 8]
6
+ a = a * 8 // [step: 9 * 9]
7
+ a = 9 * 9 // [step: 34 * 23]
8
+ a = 34 * 23 // [step: print]
9
+ print(a) // [cont]
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def fact (x : Int ): Int = {
3
+ if (x == 0 )
4
+ 1
5
+ else
6
+ x * fact(x - 1 ) // TODO: incorrect this line when x = 0
7
+ }
8
+
9
+
10
+ def main (args : Array [String ]): Unit = {
11
+ val a = 1 + 2
12
+ val b = a * 9 // [break] [step: fact]
13
+ val c = fact(a) // [step: x == 0] [step: fact(x - 1)] [step: x == 0] [cont]
14
+ fact(0 ) // [break] [step: x == 0] [step: 1] [step: fact(x - 1)] [step: print]
15
+ print(c) // [cont]
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments