Skip to content

Commit 5c850b5

Browse files
committed
Fix printing varargs _*
1 parent 90904e8 commit 5c850b5

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

library/src/scala/tasty/util/ShowSourceCode.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,10 +864,15 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
864864
printRefinement(tpe)
865865

866866
case Type.AppliedType(tp, args) =>
867-
printType(tp)
868-
this += "["
869-
printTypesOrBounds(args, ", ")
870-
this += "]"
867+
tp match {
868+
case Type.TypeRef("<repeated>", Types.ScalaPackage()) =>
869+
this += "_*"
870+
case _ =>
871+
printType(tp)
872+
this += "["
873+
printTypesOrBounds(args, ", ")
874+
this += "]"
875+
}
871876

872877
case Type.AnnotatedType(tp, annot) =>
873878
val Annotation(ref, args) = annot

tests/run/t889.decompiled

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** Decompiled from out/runTestFromTasty/run/t889/Test.class */
2+
object Test extends dotty.runtime.LegacyApp() {
3+
val a: collection.immutable.List[java.lang.String] = scala.List.apply[java.lang.String]("a")
4+
Test.a match {
5+
case scala.Seq("a", "b", rest: _*) =>
6+
scala.Predef.println("a, b, ".+(rest))
7+
case scala.Seq(first, rest: _*) =>
8+
scala.Predef.println("first: ".+(first).+(", rest: ").+(rest))
9+
}
10+
}

0 commit comments

Comments
 (0)