Skip to content

Commit e3960ae

Browse files
Merge pull request #4692 from dotty-staging/fix-pinting-return
Fix printing `return`
2 parents 8390432 + 03dca96 commit e3960ae

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
395395
}
396396

397397
case Term.Return(expr) =>
398-
this += "}"
398+
this += "return "
399399
printTree(expr)
400400

401401
case Term.Repeated(elems) =>

tests/pos/t3869.decompiled

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/** Decompiled from out/posTestFromTasty/pos/t3869/Test.class */
2+
object Test {
3+
def f: scala.Unit = try return () finally while (true) ()
4+
def main(args: scala.Array[scala.Predef.String]): scala.Unit = {
5+
Test.f
6+
}
7+
}

0 commit comments

Comments
 (0)