diff --git a/community-build/community-projects/scalatest b/community-build/community-projects/scalatest index 96650cfbf700..75f5a3be6632 160000 --- a/community-build/community-projects/scalatest +++ b/community-build/community-projects/scalatest @@ -1 +1 @@ -Subproject commit 96650cfbf7003c198e2759bdca4a9a37dac03cad +Subproject commit 75f5a3be66322f69ea624bbf5f166fbd28c5ff9e diff --git a/compiler/src/dotty/tools/dotc/transform/LiftTry.scala b/compiler/src/dotty/tools/dotc/transform/LiftTry.scala index e5e234b8fe8e..074ba7bc0516 100644 --- a/compiler/src/dotty/tools/dotc/transform/LiftTry.scala +++ b/compiler/src/dotty/tools/dotc/transform/LiftTry.scala @@ -44,6 +44,9 @@ class LiftTry extends MiniPhase with IdentityDenotTransformer { thisPhase => override def prepareForApply(tree: Apply)(using Context): Context = liftingCtx(true) + override def prepareForDefDef(tree: DefDef)(using Context): Context = + liftingCtx(false) + override def prepareForValDef(tree: ValDef)(using Context): Context = if !tree.symbol.exists || tree.symbol.isSelfSym diff --git a/tests/pos/i13941.scala b/tests/pos/i13941.scala new file mode 100644 index 000000000000..299470e455e3 --- /dev/null +++ b/tests/pos/i13941.scala @@ -0,0 +1,15 @@ +import scala.annotation.tailrec + +object A { + def b = Option("a").map { x => + @tailrec + def loop(): Int = { + try + 2 + catch + case _: Throwable => + loop() + } + x + } +}