proper discrimination between csEmpty and csNoMatch
fixes twrongtupleaccess and topaque
This commit is contained in:
parent
bdeaee4a33
commit
dc33638cb2
2 changed files with 9 additions and 6 deletions
|
|
@ -50,7 +50,8 @@ proc
|
||||||
if sym == nil: return
|
if sym == nil: return
|
||||||
initCandidate(best, sym, initialBinding, symScope)
|
initCandidate(best, sym, initialBinding, symScope)
|
||||||
initCandidate(alt, sym, initialBinding, symScope)
|
initCandidate(alt, sym, initialBinding, symScope)
|
||||||
|
best.state = csNoMatch
|
||||||
|
|
||||||
while sym != nil:
|
while sym != nil:
|
||||||
if sym.kind in filter:
|
if sym.kind in filter:
|
||||||
determineType(c, sym)
|
determineType(c, sym)
|
||||||
|
|
@ -115,7 +116,8 @@ proc resolveOverloads(c: PContext, n, orig: PNode,
|
||||||
|
|
||||||
pickBest(f)
|
pickBest(f)
|
||||||
|
|
||||||
if result.state == csEmpty:
|
let overloadsState = result.state
|
||||||
|
if overloadsState != csMatch:
|
||||||
if nfDelegate in n.flags:
|
if nfDelegate in n.flags:
|
||||||
InternalAssert f.kind == nkIdent
|
InternalAssert f.kind == nkIdent
|
||||||
let calleeName = newStrNode(nkStrLit, f.ident.s)
|
let calleeName = newStrNode(nkStrLit, f.ident.s)
|
||||||
|
|
@ -127,7 +129,10 @@ proc resolveOverloads(c: PContext, n, orig: PNode,
|
||||||
|
|
||||||
pickBest(callOp)
|
pickBest(callOp)
|
||||||
|
|
||||||
if result.state == csEmpty:
|
if overloadsState == csEmpty and result.state == csEmpty:
|
||||||
|
LocalError(n.info, errUndeclaredIdentifier, considerAcc(f).s)
|
||||||
|
return
|
||||||
|
elif result.state != csMatch:
|
||||||
if nfExprCall in n.flags:
|
if nfExprCall in n.flags:
|
||||||
if c.inCompilesContext > 0 or gErrorCounter == 0:
|
if c.inCompilesContext > 0 or gErrorCounter == 0:
|
||||||
LocalError(n.info, errExprXCannotBeCalled,
|
LocalError(n.info, errExprXCannotBeCalled,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
discard """
|
discard """
|
||||||
file: "twrongtupleaccess.nim"
|
file: "twrongtupleaccess.nim"
|
||||||
line: 9
|
line: 9
|
||||||
errormsg: "undeclared field: \'setBLAH\'"
|
errormsg: "undeclared identifier: \'setBLAH\'"
|
||||||
"""
|
"""
|
||||||
# Bugfix
|
# Bugfix
|
||||||
|
|
||||||
var v = (5.0, 10.0)
|
var v = (5.0, 10.0)
|
||||||
v.setBLAH(10)
|
v.setBLAH(10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue