mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-04 10:54:42 +00:00
fixes #4353
This commit is contained in:
@@ -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}:
|
||||
|
||||
@@ -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 =
|
||||
|
||||
4
tests/lookups/tprefer_proc.nim
Normal file
4
tests/lookups/tprefer_proc.nim
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
# bug #4353
|
||||
import random
|
||||
echo random[int](low(int) .. high(int))
|
||||
Reference in New Issue
Block a user