summaryrefslogtreecommitdiff
path: root/src/library/scala/reflect/api/Positions.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/reflect/api/Positions.scala')
-rw-r--r--src/library/scala/reflect/api/Positions.scala18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/library/scala/reflect/api/Positions.scala b/src/library/scala/reflect/api/Positions.scala
index 181e7c1525..4c8c33bec8 100644
--- a/src/library/scala/reflect/api/Positions.scala
+++ b/src/library/scala/reflect/api/Positions.scala
@@ -1,9 +1,21 @@
package scala.reflect
package api
-trait Positions {
+trait Positions { self: Universe =>
+ /** TreeAnnotation is a generalisation of Position.
+ *
+ * TreeAnnotation cannot be an upperbound of Position since the corresponding classes
+ * must live outside of the universe for backwards compatibility (see scala.tools.nsc.util.Position).
+ * Thus, represent subtyping as coercions.
+ *
+ * Typically, positionToAnnotation is the identity, and annotationToPosition returns annot.pos
+ */
+ type TreeAnnotation // <: { def pos: Position }
+ val NoTreeAnnotation: TreeAnnotation
+ implicit def positionToAnnotation(pos: Position): TreeAnnotation // = pos
+ def annotationToPosition(annot: TreeAnnotation): Position // = annot.pos
+ def _checkSetAnnotation(tree: Tree, annot: TreeAnnotation): Unit = () // check that annot may overwrite tree.annot
- type Position
+ type Position // <: TreeAnnotation, but not practical to enforce this (would require moving Position, SourceFile, Reporter,... into the universe)
val NoPosition: Position
-
} \ No newline at end of file