This commit is contained in:
Andreas Rumpf
2016-08-04 19:36:13 +02:00
parent 4a96a3d9a1
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
case n.kind
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)
result = semSym(c, n, s, flags)
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
a = initOverloadIter(o, c, n)
while a != nil:
if a.kind != skModule:
inc(i)
if i > 1: break
a = nextOverloadIter(o, c, n)
inc(i)
if i > 1: break
if i <= 1 and r != scForceOpen:
# XXX this makes more sense but breaks bootstrapping for now:
# (s.kind notin routineKinds or s.magic != mNone):
@@ -68,8 +69,9 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule): PNode =
result = newNodeIT(kind, n.info, newTypeS(tyNone, c))
a = initOverloadIter(o, c, n)
while a != nil:
incl(a.flags, sfUsed)
addSon(result, newSymNode(a, n.info))
if a.kind != skModule:
incl(a.flags, sfUsed)
addSon(result, newSymNode(a, n.info))
a = nextOverloadIter(o, c, n)
proc semBindStmt(c: PContext, n: PNode, toBind: var IntSet): PNode =

View File

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