Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/src/dotty/tools/dotc/transform/LiftTry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions tests/pos/i13941.scala
Original file line number Diff line number Diff line change
@@ -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
}
}