diff options
author | Martin Odersky <odersky@gmail.com> | 2013-08-22 14:24:49 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-08-22 14:24:49 +0200 |
commit | 749934aeafecc65c865d92056467c08540add8cc (patch) | |
tree | 7b20ad103b0acb5b08f96c146a5a8c217a8e4b82 /src/dotty/tools/dotc/ast/Trees.scala | |
parent | cbcdbd6fb8c0bf372a61b4ddd5b6ce181964776d (diff) | |
download | dotty-749934aeafecc65c865d92056467c08540add8cc.tar.gz dotty-749934aeafecc65c865d92056467c08540add8cc.tar.bz2 dotty-749934aeafecc65c865d92056467c08540add8cc.zip |
More typer bug fixes and improvements in error messages
Diffstat (limited to 'src/dotty/tools/dotc/ast/Trees.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/Trees.scala | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala index 8157c287d..254818b27 100644 --- a/src/dotty/tools/dotc/ast/Trees.scala +++ b/src/dotty/tools/dotc/ast/Trees.scala @@ -180,7 +180,13 @@ object Trees { /** Return a typed tree that's isomorphic to this tree, but has given * type. (Overridden by empty trees) */ - def withType(tpe: Type): ThisTree[Type] = { + def withType(tpe: Type)(implicit ctx: Context): ThisTree[Type] = { + // temporary solution to catch unreported errors early + if (tpe == ErrorType) assert(ctx.reporter.hasErrors) + withTypeUnchecked(tpe) + } + + def withTypeUnchecked(tpe: Type): ThisTree[Type] = { val tree = (if (myTpe == null || (myTpe.asInstanceOf[AnyRef] eq tpe.asInstanceOf[AnyRef])) this @@ -650,7 +656,7 @@ object Trees { trait WithoutType[-T >: Untyped] extends Tree[T] { override def tpe: T @uncheckedVariance = NoType.asInstanceOf[T] - override def withType(tpe: Type) = this.asInstanceOf[ThisTree[Type]] + override def withTypeUnchecked(tpe: Type) = this.asInstanceOf[ThisTree[Type]] } /** Temporary class that results from translation of ModuleDefs @@ -816,9 +822,6 @@ object Trees { def finalize(tree: Tree, copied: untpd.Tree): copied.ThisTree[T] = postProcess(tree, copied withPos tree.pos) - private def copyAttrs(t: untpd.Tree, tree: Tree): t.ThisTree[T] = - t.withType(tree.typeOpt).withPos(tree.pos).asInstanceOf[t.ThisTree[T]] - def Ident(tree: Tree, name: Name): Ident = tree match { case tree: BackquotedIdent => if (name == tree.name) tree |