summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
2 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index cf612ad7a0..8bb7b77154 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -317,7 +317,15 @@ trait Trees extends reflect.generic.Trees { self: SymbolTable =>
private[Trees] var wasEmpty: Boolean = false
def original: Tree = orig
- def setOriginal(tree: Tree): this.type = { orig = tree; setPos(tree.pos); this }
+ def setOriginal(tree: Tree): this.type = {
+ def followOriginal(t: Tree): Tree = t match {
+ case tt: TypeTree => followOriginal(tt.original)
+ case t => t
+ }
+
+ orig = followOriginal(tree); setPos(tree.pos);
+ this
+ }
override def defineType(tp: Type): this.type = {
wasEmpty = isEmpty
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index b5e58a9dae..08d5f0e12d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1425,7 +1425,7 @@ trait Typers extends Modes {
val tpt1 =
checkNoEscaping.privates(
clazz.thisSym,
- treeCopy.TypeTree(tpt) setType vd.symbol.tpe)
+ treeCopy.TypeTree(tpt).setOriginal(tpt) setType vd.symbol.tpe)
treeCopy.ValDef(vd, mods, name, tpt1, EmptyTree) setType NoType
}
// was: