aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/util
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-29 18:36:18 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-29 18:36:18 +0100
commit0553f08eaeee1f9ac7ef6c28b341a92e0fb452e3 (patch)
tree497e40b6b4c6ee37f7a24259296a15d50371fd91 /src/dotty/tools/dotc/util
parent3f39cd8e15c321cf6ac97a0137087f7c2d69ce60 (diff)
downloaddotty-0553f08eaeee1f9ac7ef6c28b341a92e0fb452e3.tar.gz
dotty-0553f08eaeee1f9ac7ef6c28b341a92e0fb452e3.tar.bz2
dotty-0553f08eaeee1f9ac7ef6c28b341a92e0fb452e3.zip
Tightening of position handlng
1) endPos works now even for NoPosition. 2) On the other hand, there's an assertion in Typer.typed which requires every non-empty tree that's type checked in a globally committable context to have a defined position. Some fixes were needed to make the tests pass the new assert.
Diffstat (limited to 'src/dotty/tools/dotc/util')
-rw-r--r--src/dotty/tools/dotc/util/Positions.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/util/Positions.scala b/src/dotty/tools/dotc/util/Positions.scala
index 6dfb78c87..21ee788ca 100644
--- a/src/dotty/tools/dotc/util/Positions.scala
+++ b/src/dotty/tools/dotc/util/Positions.scala
@@ -78,13 +78,13 @@ object Positions {
else this
/** The zero-extent position with start and end at the point of this position */
- def focus = Position(point)
+ def focus = if (exists) Position(point) else NoPosition
/** The zero-extent position with start and end at the start of this position */
- def startPos = Position(start)
+ def startPos = if (exists) Position(start) else NoPosition
/** The zero-extent position with start and end at the end of this position */
- def endPos = Position(end)
+ def endPos = if (exists) Position(end) else NoPosition
/** A copy of this position with a different start */
def withStart(start: Int) =