Skip to content

Commit c0974f6

Browse files
authored
Let show behave more robustly for Recheck (#21678)
The pretty-printing logic for a Recheck phase applies the phase to the tree. But if there was a type error, then the pretty printing would have previously crashed the compiler. Fixes #21646
2 parents ac28899 + 0f2613c commit c0974f6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: compiler/src/dotty/tools/dotc/transform/Recheck.scala

+7-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ object Recheck:
3333

3434
val addRecheckedTypes = new TreeMap:
3535
override def transform(tree: Tree)(using Context): Tree =
36-
val tree1 = super.transform(tree)
37-
tree.getAttachment(RecheckedType) match
38-
case Some(tpe) => tree1.withType(tpe)
39-
case None => tree1
36+
try
37+
val tree1 = super.transform(tree)
38+
tree.getAttachment(RecheckedType) match
39+
case Some(tpe) => tree1.withType(tpe)
40+
case None => tree1
41+
catch
42+
case _:TypeError => tree
4043

4144
extension (sym: Symbol)(using Context)
4245

0 commit comments

Comments
 (0)