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]()
           ^
This commit is contained in:
alaviss 2019-01-23 15:24:21 +07:00 • committed by Andreas Rumpf
commit e962be8981
5 changed files with 56 additions and 19 deletions

View file

@ -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 =