diff options
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index ba99ed0ca..224b3fcb1 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -851,9 +851,13 @@ class Typer extends Namer with Applications with Implicits { } def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = ctx.traceIndented (s"typing ${tree.show}", show = true) { - val tree1 = typedUnadapted(tree, pt) - ctx.interpolateUndetVars(tree1.tpe.widen, tree1.pos) - adapt(tree1, pt) + try { + val tree1 = typedUnadapted(tree, pt) + ctx.interpolateUndetVars(tree1.tpe.widen, tree1.pos) + adapt(tree1, pt) + } catch { + case ex: FatalTypeError => errorTree(tree, ex.getMessage) + } } def typedTrees(trees: List[untpd.Tree])(implicit ctx: Context): List[Tree] = |