Permalink
Browse files

Making the locator more robust in the face of weird originals. And ch…

…anged positions in AnnotationInfo to avoid position-less trees there.

Conflicts:

	src/compiler/scala/tools/nsc/typechecker/Typers.scala
  • Loading branch information...
odersky authored and dragos committed May 8, 2012
1 parent aa555de commit f9410256d97d8b8001e96291016d25f020013784
@@ -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
@@ -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?

This comment has been minimized.

Show comment
Hide comment
@paulp

paulp May 8, 2012

Contributor

It compiles for me without the cast.

@paulp

paulp May 8, 2012

Contributor

It compiles for me without the cast.

}
} else if (requireJava) {
reportAnnotationError(NestedAnnotationError(ann, annType))

0 comments on commit f941025

Please sign in to comment.