diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2015-03-25 01:49:23 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2015-03-25 01:51:37 +0100 |
commit | 658eb4ba1a080379e7ec7a0217cd9f0b7332c1a2 (patch) | |
tree | 88bd1fb04b538f16f304bd219f1853569e673448 | |
parent | c6792189ff2075ac8b90efc7fad42aafd6a7b67e (diff) | |
download | dotty-658eb4ba1a080379e7ec7a0217cd9f0b7332c1a2.tar.gz dotty-658eb4ba1a080379e7ec7a0217cd9f0b7332c1a2.tar.bz2 dotty-658eb4ba1a080379e7ec7a0217cd9f0b7332c1a2.zip |
Make implicit conversion from Position to Coord work for NoPosition
-rw-r--r-- | src/dotty/tools/dotc/util/Positions.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/util/Positions.scala b/src/dotty/tools/dotc/util/Positions.scala index 744f97340..1f9e24897 100644 --- a/src/dotty/tools/dotc/util/Positions.scala +++ b/src/dotty/tools/dotc/util/Positions.scala @@ -164,7 +164,9 @@ object Positions { /** An index coordinate */ implicit def indexCoord(n: Int): Coord = new Coord(n + 1) - implicit def positionCoord(pos: Position): Coord = new Coord(-(pos.point + 1)) + implicit def positionCoord(pos: Position): Coord = + if (pos.exists) new Coord(-(pos.point + 1)) + else NoCoord /** A sentinel for a missing coordinate */ val NoCoord = new Coord(0) |