Skip to content

Commit

Permalink
Merge pull request scala#4704 from dotty-staging/decompile-fix-alt
Browse files Browse the repository at this point in the history
Fix printing binded alternatives
  • Loading branch information
nicolasstucki authored Jun 22, 2018
2 parents 6fb7970 + 60ed50f commit fce7ef8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/src/scala/tasty/util/ShowSourceCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,9 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
this += ")"

case Pattern.Alternative(trees) =>
this += "("
printPatterns(trees, " | ")
this += ")"

case Pattern.TypeTest(tpt) =>
this += "_: "
Expand Down
17 changes: 17 additions & 0 deletions tests/run/virtpatmat_alts.decompiled
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/** Decompiled from out/runTestFromTasty/run/virtpatmat_alts/Test.class */
object Test extends dotty.runtime.LegacyApp() {
scala.Tuple2.apply[scala.Boolean, scala.Boolean](true, true) match {
case (scala.Tuple2(true, true) | scala.Tuple2(false, false)) =>
1
}
scala.List.apply[scala.Int](5) match {
case (scala.::(1, scala.Nil) | scala.::(2, scala.Nil)) =>
scala.Predef.println("FAILED")
case scala.::(x @ (4 | 5 | 6), scala.Nil) =>
scala.Predef.println("OK ".+(x))
case scala.::(7, scala.Nil) =>
scala.Predef.println("FAILED")
case scala.Nil =>
scala.Predef.println("FAILED")
}
}

0 comments on commit fce7ef8

Please sign in to comment.