Skip to content

Commit 270f661

Browse files
committed
Update test to show that scala#7942 is fixed
1 parent 87bce7b commit 270f661

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

tests/run/targetName.check

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
strings: ArraySeq(hello)
2+
ints: ArraySeq(1, 2)
3+
objs: ArraySeq(1, hi)

tests/run/targetName.scala

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ object A:
55
@targetName("f2") def f(x: => Int): Int = x
66

77
import A._
8-
@main def Test =
9-
assert(f("abc") == f(3))
108

119
trait T:
1210
def f(x: => String): Int
@@ -21,3 +19,18 @@ object B1 extends C, T:
2119

2220
object B2 extends C, T:
2321
override def f(x: => String): Int = x.length + 1
22+
23+
@targetName("fooString") def foo(ps: String*) : Unit = println(s"strings: $ps")
24+
@targetName("fooInt") def foo(ps: Int*) : Unit = println(s"ints: $ps")
25+
@targetName("fooAny") def foo(ps: Any*) : Unit = println(s"objs: $ps")
26+
27+
@main def Test =
28+
assert(f("abc") == f(3))
29+
assert(B2.f("abc") == 4)
30+
val t: T = B1
31+
assert(t.f(2) == 3)
32+
foo("hello")
33+
foo(1, 2)
34+
foo(1, "hi")
35+
36+

0 commit comments

Comments
 (0)