Skip to content

Commit b464f3b

Browse files
authored
Merge pull request #4652 from dotty-staging/fix-missing-line-in-case-body
Add missing line break
2 parents c525a7e + 0fd65e6 commit b464f3b

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
536536
body match {
537537
case Term.Block(stats, expr) =>
538538
printTrees(stats, lineBreak())
539+
if (stats.nonEmpty)
540+
this += lineBreak()
539541
printTree(expr)
540542
case body =>
541543
printTree(body)

tests/pos/simpleMatchCase.decompiled

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** Decompiled from out/posTestFromTasty/pos/simpleMatchCase/Foo.class */
2+
class Foo() {
3+
def foo: scala.Unit = {
4+
"c" match {
5+
case x =>
6+
scala.Predef.println("a")
7+
scala.Predef.println("b")
8+
}
9+
}
10+
}

tests/pos/simpleMatchCase.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
class Foo {
3+
def foo: Unit = {
4+
"c" match {
5+
case x =>
6+
println("a")
7+
println("b")
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)