diff options
author | Paul Phillips <paulp@improving.org> | 2010-04-27 16:36:39 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-04-27 16:36:39 +0000 |
commit | 9b16201d2c982095c54b9803cee8c76b4f12024e (patch) | |
tree | 09721c98e76094311602b9debf3d8c4eb1a5ba23 /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | |
parent | 0675d244e45ea0f71a64568c832c846b19beea56 (diff) | |
download | scala-9b16201d2c982095c54b9803cee8c76b4f12024e.tar.gz scala-9b16201d2c982095c54b9803cee8c76b4f12024e.tar.bz2 scala-9b16201d2c982095c54b9803cee8c76b4f12024e.zip |
Created TypeDiagnostics trait and have begun op...
Created TypeDiagnostics trait and have begun opportunistically moving
code into it. Along the way, some improvements to error messages.
The situation described in ticket #2206 has always had an applicable
error message, but it wasn't making it out to the user. More kinds of
ambiguity are disambiguated, see the test cases. And overload errors are
printed with some formatting so one has some hope of parsing. Review by
odersky.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 003a173892..bd8482cd67 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -971,17 +971,20 @@ abstract class RefChecks extends InfoTransform { private def checkAnnotations(tpes: List[Type], pos: Position) = tpes foreach (tp => checkTypeRef(tp, pos)) private def doTypeTraversal(tree: Tree)(f: Type => Unit) = if (!inPattern) tree.tpe foreach f - private def applyRefchecksToAnnotations(tree: Tree) = tree match { - case m: MemberDef => - checkAnnotations(m.symbol.annotations map (_.atp), tree.pos) - transformTrees(m.symbol.annotations.flatMap(_.args)) - case TypeTree() => doTypeTraversal(tree) { - case AnnotatedType(annots, _, _) => - checkAnnotations(annots map (_.atp), tree.pos) - transformTrees(annots.flatMap(_.args)) + private def applyRefchecksToAnnotations(tree: Tree) = { + def applyChecks(annots: List[AnnotationInfo]) = { + checkAnnotations(annots map (_.atp), tree.pos) + transformTrees(annots flatMap (_.args)) + } + + tree match { + case m: MemberDef => applyChecks(m.symbol.annotations) + case TypeTree() => doTypeTraversal(tree) { + case AnnotatedType(annots, _, _) => applyChecks(annots) + case _ => + } case _ => } - case _ => } private def transformCaseApply(tree: Tree, ifNot: => Unit) = { |