Skip to content

Commit 025bc51

Browse files
committed
Add test case on unused with Splitter transform
Currently UnusedParams must be before Splitter. This limitation in only on the current implementation.
1 parent 7791243 commit 025bc51

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

tests/run/unused-27.check

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
block
2+
x
3+
foo

tests/run/unused-27.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
object Test {
2+
def main(args: Array[String]): Unit = {
3+
({
4+
println("block")
5+
foo
6+
})(x)
7+
}
8+
def foo(unused a: Int): Unit = {
9+
println("foo")
10+
}
11+
def x: Int = {
12+
println("x")
13+
42
14+
}
15+
}

tests/run/unused-28.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
x
2+
foo
3+
x
4+
bar

tests/run/unused-28.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
object Test {
2+
var a = true
3+
def main(args: Array[String]): Unit = {
4+
(if (a) foo else bar)(x)
5+
a = false
6+
(if (a) foo else bar)(x)
7+
}
8+
def foo(unused a: Int): Unit = {
9+
println("foo")
10+
}
11+
def bar(unused a: Int): Unit = {
12+
println("bar")
13+
}
14+
def x: Int = {
15+
println("x")
16+
42
17+
}
18+
}

0 commit comments

Comments
 (0)