From 6472e115d500bc0cae6064af2603c94c247c9732 Mon Sep 17 00:00:00 2001 From: Eugene Vigdorchik Date: Mon, 4 Oct 2010 17:20:40 +0000 Subject: Locator should follow TypeTree#original to get ... Locator should follow TypeTree#original to get the smallest tree containing a position. review by odersky --- .../tools/nsc/interactive/RangePositions.scala | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala index 889f51e7ab..cf66c80b02 100644 --- a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala +++ b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala @@ -255,16 +255,20 @@ self: scala.tools.nsc.Global => } protected def isEligible(t: Tree) = !t.pos.isTransparent override def traverse(t: Tree) { - if (t.pos includes pos) { - if (isEligible(t)) last = t - super.traverse(t) - } else if (t.symbol != null) { - for(annot <- t.symbol.annotations if (annot.pos includes pos) && !annot.pos.isTransparent) { - last = Annotated(TypeTree(annot.atp) setPos annot.pos, t) - last.setType(annot.atp) - last.setPos(annot.pos) - traverseTrees(annot.args) - } + t match { + case tt : TypeTree if tt.original != null => traverse(tt.original) + case _ => + if (t.pos includes pos) { + if (isEligible(t)) last = t + super.traverse(t) + } else if (t.symbol != null) { + for(annot <- t.symbol.annotations if (annot.pos includes pos) && !annot.pos.isTransparent) { + last = Annotated(TypeTree(annot.atp) setPos annot.pos, t) + last.setType(annot.atp) + last.setPos(annot.pos) + traverseTrees(annot.args) + } + } } } } -- cgit v1.2.3