From 50569934779e3229879ed1f65b1bb7ce54bf619a Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Tue, 24 Aug 2010 09:27:12 +0000 Subject: Correctly locate context tree even on the edges. --- src/compiler/scala/tools/nsc/interactive/ContextTrees.scala | 2 +- src/compiler/scala/tools/nsc/util/Position.scala | 2 +- 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 -- cgit v1.2.3