From e962be8981ff6ef09625b3cc89e0c0aa1f07b35a Mon Sep 17 00:00:00 2001
From: alaviss <alaviss@users.noreply.github.com>
Date: Wed, 23 Jan 2019 15:24:21 +0700
Subject: 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]()
           ^
---
 compiler/semtempl.nim | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'compiler/semtempl.nim')

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 =
-- 
cgit 1.4.1-2-gfad0