Skip to content

Commit f2ea8dd

Browse files
committed
Fix TailRec to handle inline exception handlers and non-trivial not-inlined
1 parent 5613295 commit f2ea8dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/dotty/tools/dotc/transform/TailRec.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete
237237
case Block(List((d: DefDef)), cl@Closure(Nil, _, EmptyTree)) =>
238238
val newDef = cpy.DefDef(d)(rhs = transform(d.rhs))
239239
Block(List(newDef), cl)
240-
case t: Ident => t // handler is an external function
240+
case Match(ExceptionHandlerSel, _) =>
241+
transform(t)
242+
case _: Ident|_: Apply| _: TypeApply => t // handler is an external function
241243
case _ => assert(false, s"failed to deconstruct try handler ${t.show}"); ???
242244
}
243245
}

0 commit comments

Comments
 (0)