Skip to content

Fix printing varargs _* #4701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions library/src/scala/tasty/util/ShowSourceCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -864,10 +864,15 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
printRefinement(tpe)

case Type.AppliedType(tp, args) =>
printType(tp)
this += "["
printTypesOrBounds(args, ", ")
this += "]"
tp match {
case Type.TypeRef("<repeated>", Types.ScalaPackage()) =>
this += "_*"
case _ =>
printType(tp)
this += "["
printTypesOrBounds(args, ", ")
this += "]"
}

case Type.AnnotatedType(tp, annot) =>
val Annotation(ref, args) = annot
Expand Down
10 changes: 10 additions & 0 deletions tests/run/t889.decompiled
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** Decompiled from out/runTestFromTasty/run/t889/Test.class */
object Test extends dotty.runtime.LegacyApp() {
val a: collection.immutable.List[java.lang.String] = scala.List.apply[java.lang.String]("a")
Test.a match {
case scala.Seq("a", "b", rest: _*) =>
scala.Predef.println("a, b, ".+(rest))
case scala.Seq(first, rest: _*) =>
scala.Predef.println("first: ".+(first).+(", rest: ").+(rest))
}
}