summary refs log tree commit diff stats
path: root/compiler/semtempl.nim
diff options
context:
space:
mode:
authoralaviss <alaviss@users.noreply.github.com>2019-01-23 15:24:21 +0700
committerAndreas Rumpf <rumpf_a@web.de>2019-01-23 09:24:21 +0100
commite962be8981ff6ef09625b3cc89e0c0aa1f07b35a (patch)
tree708a09ca0587adaee52c26f9129f5a4c5df91278 /compiler/semtempl.nim
parentf1a841c605870711c4b046ee8f8c0a5bbf479bf2 (diff)
downloadNim-e962be8981ff6ef09625b3cc89e0c0aa1f07b35a.tar.gz
compiler/sem*: improve lineinfo for qualified and generic procs (#10427)
Previously the compiler will believe these are where `newSeq` symbol
starts:

    newSeq[int]()
          ^
    system.newSeq[int]()
                 ^

This commit moves them back to:

    newSeq[int]()
    ^
    system.newSeq[int]()
           ^
Diffstat (limited to 'compiler/semtempl.nim')
-rw-r--r--compiler/semtempl.nim13
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim
index 14507cf9d..d920a54b8 100644
--- a/compiler/semtempl.nim
+++ b/compiler/semtempl.nim
@@ -58,25 +58,26 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule): PNode =
       inc(i)
       if i > 1: break
     a = nextOverloadIter(o, c, n)
+  let info = getCallLineInfo(n)
   if i <= 1 and r != scForceOpen:
     # XXX this makes more sense but breaks bootstrapping for now:
     # (s.kind notin routineKinds or s.magic != mNone):
     # for instance 'nextTry' is both in tables.nim and astalgo.nim ...
-    result = newSymNode(s, n.info)
-    markUsed(c.config, n.info, s, c.graph.usageSym)
-    onUse(n.info, s)
+    result = newSymNode(s, info)
+    markUsed(c.config, info, s, c.graph.usageSym)
+    onUse(info, s)
   else:
     # semantic checking requires a type; ``fitNode`` deals with it
     # appropriately
     let kind = if r == scClosed or n.kind == nkDotExpr: nkClosedSymChoice
                else: nkOpenSymChoice
-    result = newNodeIT(kind, n.info, newTypeS(tyNone, c))
+    result = newNodeIT(kind, info, newTypeS(tyNone, c))
     a = initOverloadIter(o, c, n)
     while a != nil:
       if a.kind != skModule:
         incl(a.flags, sfUsed)
-        addSon(result, newSymNode(a, n.info))
-        onUse(n.info, a)
+        addSon(result, newSymNode(a, info))
+        onUse(info, a)
       a = nextOverloadIter(o, c, n)
 
 proc semBindStmt(c: PContext, n: PNode, toBind: var IntSet): PNode =