summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@epfl.ch>2010-08-24 09:27:12 +0000
committerHubert Plociniczak <hubert.plociniczak@epfl.ch>2010-08-24 09:27:12 +0000
commit50569934779e3229879ed1f65b1bb7ce54bf619a (patch)
treeee2e5c25c459694dcfeef3b4d4ad3077b167b768
parente987f72df36f33bd40c99792b7b97aeebe2ef605 (diff)
downloadscala-50569934779e3229879ed1f65b1bb7ce54bf619a.tar.gz
scala-50569934779e3229879ed1f65b1bb7ce54bf619a.tar.bz2
scala-50569934779e3229879ed1f65b1bb7ce54bf619a.zip
Correctly locate context tree even on the edges.
-rw-r--r--src/compiler/scala/tools/nsc/interactive/ContextTrees.scala2
-rw-r--r--src/compiler/scala/tools/nsc/util/Position.scala2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala b/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala
index af50e4e468..1fad3180ab 100644
--- a/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala
+++ b/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala
@@ -46,7 +46,7 @@ trait ContextTrees { self: Global =>
if (contexts.isEmpty) None
else {
val hi = contexts.length - 1
- if ((contexts(hi).pos precedes pos) || (pos precedes contexts(0).pos)) None
+ if ((contexts(hi).pos properlyPrecedes pos) || (pos properlyPrecedes contexts(0).pos)) None
else {
def loop(lo: Int, hi: Int): Option[ContextTree] = {
val mid = (lo + hi) / 2
diff --git a/src/compiler/scala/tools/nsc/util/Position.scala b/src/compiler/scala/tools/nsc/util/Position.scala
index 8d0ff37c44..31202eec8f 100644
--- a/src/compiler/scala/tools/nsc/util/Position.scala
+++ b/src/compiler/scala/tools/nsc/util/Position.scala
@@ -154,7 +154,7 @@ trait Position {
* do not share a common point).
*/
def properlyPrecedes(pos: Position) =
- isDefined && pos.isDefined && startOrPoint < pos.endOrPoint
+ isDefined && pos.isDefined && endOrPoint < pos.startOrPoint
/** Does this position overlap with that position?
* This holds if both positions are ranges and there is an interval of