summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-05-08 13:50:32 +0200
committerIulian Dragos <jaguarul@gmail.com>2012-05-08 16:13:43 +0200
commitf9410256d97d8b8001e96291016d25f020013784 (patch)
treee38aa05c266d9d0e8f53c90dfcf1c8251b07f20f /src
parentaa555debf77eeec3a72a1d700f06347d2e489299 (diff)
downloadscala-f9410256d97d8b8001e96291016d25f020013784.tar.gz
scala-f9410256d97d8b8001e96291016d25f020013784.tar.bz2
scala-f9410256d97d8b8001e96291016d25f020013784.zip
Making the locator more robust in the face of weird originals. And changed positions in AnnotationInfo to avoid position-less trees there.
Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/interactive/RangePositions.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala
index 72e5ee42ed..49ba9d0aeb 100644
--- a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala
+++ b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala
@@ -269,7 +269,8 @@ self: scala.tools.nsc.Global =>
protected def isEligible(t: Tree) = !t.pos.isTransparent
override def traverse(t: Tree) {
t match {
- case tt : TypeTree if tt.original != null => traverse(tt.original)
+ case tt : TypeTree if tt.original != null && (tt.pos includes tt.original.pos) =>
+ traverse(tt.original)
case _ =>
if (t.pos includes pos) {
if (isEligible(t)) last = t
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 8c2eae1c86..08d6bd7226 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -921,7 +921,7 @@ trait Typers extends Modes with Adaptations with Taggings {
KindArityMismatchError(tree, pt)
} else tree match { // (6)
case TypeTree() => tree
- case _ => TypeTree(tree.tpe) setOriginal (tree) setPos (tree.pos)
+ case _ => TypeTree(tree.tpe) setOriginal tree
}
}
@@ -3230,7 +3230,7 @@ trait Typers extends Modes with Adaptations with Taggings {
}
if (hasError) annotationError
- else AnnotationInfo(annType, List(), nvPairs map {p => (p._1, p._2.get)}).setOriginal(Apply(typedFun, args)).setPos(ann.pos)
+ else AnnotationInfo(annType, List(), nvPairs map {p => (p._1.asInstanceOf[Name], p._2.get)}).setOriginal(Apply(typedFun, args).setPos(ann.pos)) // [Eugene+] why do we need this cast?
}
} else if (requireJava) {
reportAnnotationError(NestedAnnotationError(ann, annType))