summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2011-03-25 17:10:01 +0000
committerIulian Dragos <jaguarul@gmail.com>2011-03-25 17:10:01 +0000
commit15e491b4d24493bd46bc067b67190246ac852b40 (patch)
tree544f529cb797e1bdbe4e965c9851be1764b1105a
parentaf3b3d39456b7157146c53426b2639b8271ed835 (diff)
downloadscala-15e491b4d24493bd46bc067b67190246ac852b40.tar.gz
scala-15e491b4d24493bd46bc067b67190246ac852b40.tar.bz2
scala-15e491b4d24493bd46bc067b67190246ac852b40.zip
Set the original tree for TypeTree in self-type...
Set the original tree for TypeTree in self-types, and making sure there are no cycles in TypeTree.original. review by odersky.
-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: