Skip to content

Commit 2a76132

Browse files
committed
Merged revisions 24591 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r24591 | dragos | 2011-03-25 18:10:01 +0100 (Fri, 25 Mar 2011) | 1 line Set the original tree for TypeTree in self-types, and making sure there are no cycles in TypeTree.original. review by odersky. ........
1 parent 63466a4 commit 2a76132

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/compiler/scala/tools/nsc/ast/Trees.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,15 @@ trait Trees extends reflect.generic.Trees { self: SymbolTable =>
317317
private[Trees] var wasEmpty: Boolean = false
318318

319319
def original: Tree = orig
320-
def setOriginal(tree: Tree): this.type = { orig = tree; setPos(tree.pos); this }
320+
def setOriginal(tree: Tree): this.type = {
321+
def followOriginal(t: Tree): Tree = t match {
322+
case tt: TypeTree => followOriginal(tt.original)
323+
case t => t
324+
}
325+
326+
orig = followOriginal(tree); setPos(tree.pos);
327+
this
328+
}
321329

322330
override def defineType(tp: Type): this.type = {
323331
wasEmpty = isEmpty

src/compiler/scala/tools/nsc/typechecker/Typers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ trait Typers extends Modes {
14251425
val tpt1 =
14261426
checkNoEscaping.privates(
14271427
clazz.thisSym,
1428-
treeCopy.TypeTree(tpt) setType vd.symbol.tpe)
1428+
treeCopy.TypeTree(tpt).setOriginal(tpt) setType vd.symbol.tpe)
14291429
treeCopy.ValDef(vd, mods, name, tpt1, EmptyTree) setType NoType
14301430
}
14311431
// was:

0 commit comments

Comments
 (0)