summary refs log tree commit diff stats
path: root/compiler/suggest.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-03-02 12:23:35 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-03-02 12:23:35 +0100
commit3e7b04683c7912cc49d05444187ca3bde7bc18aa (patch)
tree7fd4c7c12e0b51f381b81d9c9ce2b4387c5514e8 /compiler/suggest.nim
parentee13c8014bfb6a3100b8e0d3150b755ba36b44e4 (diff)
downloadNim-3e7b04683c7912cc49d05444187ca3bde7bc18aa.tar.gz
make tests green again
Diffstat (limited to 'compiler/suggest.nim')
-rw-r--r--compiler/suggest.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/suggest.nim b/compiler/suggest.nim
index e2aeb414e..41d61c12a 100644
--- a/compiler/suggest.nim
+++ b/compiler/suggest.nim
@@ -161,6 +161,8 @@ proc filterSym(s: PSym; prefix: PNode): bool {.inline.} =
       if n.len > 0:
         result = prefixMatch(s, n[0])
     else: discard
+    if result:
+      echo "indeed a prefix match ", n
   if s.kind != skModule:
     result = prefix.isNil or prefixMatch(s, prefix)
 
@@ -471,7 +473,10 @@ proc suggestExpr*(c: PContext, node: PNode) =
     if n == nil: n = node
     if n.kind == nkDotExpr:
       var obj = safeSemExpr(c, n.sons[0])
-      let prefix = if n.len == 2: n[1] else: nil
+      # it can happen that errnously we have collected the fieldname
+      # of the next line, so we check the 'field' is actually on the same
+      # line as the object to prevent this from happening:
+      let prefix = if n.len == 2 and n[1].info.line == n[0].info.line: n[1] else: nil
       suggestFieldAccess(c, obj, prefix, outputs)
 
       #if optIdeDebug in gGlobalOptions: