diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-16 18:33:39 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-16 18:34:24 +0100 |
commit | e1e372cc833e3e9d0d02c1ffa453667f50dbc784 (patch) | |
tree | a28dd45cf2c696204e82dddfd2a4e0ba8e06517e /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 00507cf758cfafa36dc4da372a7e53028fa979a4 (diff) | |
download | dotty-e1e372cc833e3e9d0d02c1ffa453667f50dbc784.tar.gz dotty-e1e372cc833e3e9d0d02c1ffa453667f50dbc784.tar.bz2 dotty-e1e372cc833e3e9d0d02c1ffa453667f50dbc784.zip |
Better handling of cyclic reference errors.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 20f9aeb19..6b6252638 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -831,8 +831,9 @@ class Typer extends Namer with Applications with Implicits { typedTree remove xtree match { case Some(ttree) => ttree case none => - val sym = symOfTree.remove(xtree).getOrElse(NoSymbol) + val sym = symOfTree.getOrElse(xtree, NoSymbol) sym.ensureCompleted() + symOfTree.remove(xtree) def localContext = ctx.fresh.withOwner(sym).withTree(xtree) def typedNamed(tree: untpd.NameTree): Tree = tree match { @@ -900,6 +901,7 @@ 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) { try adapt(typedUnadapted(tree, pt), pt) catch { + case ex: CyclicReference => errorTree(tree, cyclicErrorMsg(ex)) case ex: FatalTypeError => errorTree(tree, ex.getMessage) } } |