From 749934aeafecc65c865d92056467c08540add8cc Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 22 Aug 2013 14:24:49 +0200 Subject: More typer bug fixes and improvements in error messages --- src/dotty/tools/dotc/ast/Trees.scala | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/dotty/tools/dotc/ast/Trees.scala') 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 -- cgit v1.2.3