Skip to content

Commit fce7ef8

Browse files
Merge pull request #4704 from dotty-staging/decompile-fix-alt
Fix printing binded alternatives
2 parents 6fb7970 + 60ed50f commit fce7ef8

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,9 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
677677
this += ")"
678678

679679
case Pattern.Alternative(trees) =>
680+
this += "("
680681
printPatterns(trees, " | ")
682+
this += ")"
681683

682684
case Pattern.TypeTest(tpt) =>
683685
this += "_: "

tests/run/virtpatmat_alts.decompiled

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/** Decompiled from out/runTestFromTasty/run/virtpatmat_alts/Test.class */
2+
object Test extends dotty.runtime.LegacyApp() {
3+
scala.Tuple2.apply[scala.Boolean, scala.Boolean](true, true) match {
4+
case (scala.Tuple2(true, true) | scala.Tuple2(false, false)) =>
5+
1
6+
}
7+
scala.List.apply[scala.Int](5) match {
8+
case (scala.::(1, scala.Nil) | scala.::(2, scala.Nil)) =>
9+
scala.Predef.println("FAILED")
10+
case scala.::(x @ (4 | 5 | 6), scala.Nil) =>
11+
scala.Predef.println("OK ".+(x))
12+
case scala.::(7, scala.Nil) =>
13+
scala.Predef.println("FAILED")
14+
case scala.Nil =>
15+
scala.Predef.println("FAILED")
16+
}
17+
}

0 commit comments

Comments
 (0)