This commit is contained in:
Andreas Rumpf 2016-08-04 19:36:13 +02:00
commit 5d56361383
3 changed files with 13 additions and 5 deletions

View file

@ -2216,7 +2216,9 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
if nfSem in n.flags: return if nfSem in n.flags: return
case n.kind case n.kind
of nkIdent, nkAccQuoted: of nkIdent, nkAccQuoted:
var s = lookUp(c, n) let checks = if efNoEvaluateGeneric in flags: {checkUndeclared}
else: {checkUndeclared, checkModule, checkAmbiguity}
var s = qualifiedLookUp(c, n, checks)
if c.inTypeClass == 0: semCaptureSym(s, c.p.owner) if c.inTypeClass == 0: semCaptureSym(s, c.p.owner)
result = semSym(c, n, s, flags) result = semSym(c, n, s, flags)
if s.kind in {skProc, skMethod, skConverter, skIterator}: if s.kind in {skProc, skMethod, skConverter, skIterator}:

View file

@ -51,9 +51,10 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule): PNode =
var i = 0 var i = 0
a = initOverloadIter(o, c, n) a = initOverloadIter(o, c, n)
while a != nil: while a != nil:
a = nextOverloadIter(o, c, n) if a.kind != skModule:
inc(i) inc(i)
if i > 1: break if i > 1: break
a = nextOverloadIter(o, c, n)
if i <= 1 and r != scForceOpen: if i <= 1 and r != scForceOpen:
# XXX this makes more sense but breaks bootstrapping for now: # XXX this makes more sense but breaks bootstrapping for now:
# (s.kind notin routineKinds or s.magic != mNone): # (s.kind notin routineKinds or s.magic != mNone):
@ -68,6 +69,7 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule): PNode =
result = newNodeIT(kind, n.info, newTypeS(tyNone, c)) result = newNodeIT(kind, n.info, newTypeS(tyNone, c))
a = initOverloadIter(o, c, n) a = initOverloadIter(o, c, n)
while a != nil: while a != nil:
if a.kind != skModule:
incl(a.flags, sfUsed) incl(a.flags, sfUsed)
addSon(result, newSymNode(a, n.info)) addSon(result, newSymNode(a, n.info))
a = nextOverloadIter(o, c, n) a = nextOverloadIter(o, c, n)

View file

@ -0,0 +1,4 @@
# bug #4353
import random
echo random[int](low(int) .. high(int))