From 15e4ee08a59979b570297150b64a5d462f6cc855 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 16:07:52 +0100 Subject: [PATCH] Localize TypeError handling in addRecheckedTypes [Cherry-picked 0f2613c7aec3c222e191ca86301db1fb8127a716][modified] --- compiler/src/dotty/tools/dotc/transform/Recheck.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/transform/Recheck.scala b/compiler/src/dotty/tools/dotc/transform/Recheck.scala index 5963a98f50f2..2eebc2347eec 100644 --- a/compiler/src/dotty/tools/dotc/transform/Recheck.scala +++ b/compiler/src/dotty/tools/dotc/transform/Recheck.scala @@ -39,10 +39,13 @@ object Recheck: val addRecheckedTypes = new TreeMap: override def transform(tree: Tree)(using Context): Tree = - val tree1 = super.transform(tree) - tree.getAttachment(RecheckedType) match - case Some(tpe) => tree1.withType(tpe) - case None => tree1 + try + val tree1 = super.transform(tree) + tree.getAttachment(RecheckedType) match + case Some(tpe) => tree1.withType(tpe) + case None => tree1 + catch + case _:TypeError => tree extension (sym: Symbol)