Skip to content

Commit

Permalink
Merge pull request scala#4701 from dotty-staging/decompile-fix-varargs
Browse files Browse the repository at this point in the history
Fix printing varargs _*
  • Loading branch information
nicolasstucki authored Jun 22, 2018
2 parents 4449c9f + 5c850b5 commit 6199d07
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
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 @@ -869,10 +869,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))
}
}

0 comments on commit 6199d07

Please sign in to comment.