mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-02 11:12:37 +00:00
fix tnoop
This commit requires further investigation. Fixing semExpr(nkCall) once and for all to work with sym-choices and to allow overloading with immediate templates and macros will probably set this straight too.
This commit is contained in:
@@ -354,6 +354,7 @@ type
|
||||
nfTransf, # node has been transformed
|
||||
nfSem # node has been checked for semantics
|
||||
nfDelegate # the call can use a delegator
|
||||
nfExprCall # this is an attempt to call a regular expression
|
||||
|
||||
TNodeFlags* = set[TNodeFlag]
|
||||
TTypeFlag* = enum # keep below 32 for efficiency reasons (now: 23)
|
||||
|
||||
@@ -128,9 +128,14 @@ proc resolveOverloads(c: PContext, n, orig: PNode,
|
||||
pickBest(callOp)
|
||||
|
||||
if result.state == csEmpty:
|
||||
errors = @[]
|
||||
pickBest(f)
|
||||
NotFoundError(c, n, errors)
|
||||
if nfExprCall in n.flags:
|
||||
if c.inCompilesContext > 0 or gErrorCounter == 0:
|
||||
LocalError(n.info, errExprXCannotBeCalled,
|
||||
renderTree(n, {renderNoComments}))
|
||||
else:
|
||||
errors = @[]
|
||||
pickBest(f)
|
||||
NotFoundError(c, n, errors)
|
||||
return
|
||||
|
||||
if alt.state == csMatch and cmpCandidates(result, alt) == 0 and
|
||||
|
||||
@@ -732,14 +732,12 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
# Now that nkSym does not imply an iteration over the proc/iterator space,
|
||||
# the old ``prc`` (which is likely an nkIdent) has to be restored:
|
||||
if result == nil:
|
||||
# XXX: hmm, what kind of symbols will end up here?
|
||||
# do we really need to try the overload resolution?
|
||||
n.sons[0] = prc
|
||||
nOrig.sons[0] = prc
|
||||
n.flags.incl nfExprCall
|
||||
result = semOverloadedCallAnalyseEffects(c, n, nOrig, flags)
|
||||
if result == nil:
|
||||
if c.inCompilesContext > 0 or gErrorCounter == 0:
|
||||
LocalError(n.info, errExprXCannotBeCalled,
|
||||
renderTree(n, {renderNoComments}))
|
||||
return errorNode(c, n)
|
||||
#result = afterCallActions(c, result, nOrig, flags)
|
||||
fixAbstractType(c, result)
|
||||
analyseIfAddressTakenInCall(c, result)
|
||||
|
||||
@@ -3,11 +3,10 @@ discard """
|
||||
line: 11
|
||||
errormsg: "expression \'a()\' cannot be called"
|
||||
"""
|
||||
# Tests the new check in the semantic pass
|
||||
|
||||
var
|
||||
a: int
|
||||
|
||||
a() #ERROR_MSG expression 'a()' cannot be called
|
||||
# Tests the new check in the semantic pass
|
||||
|
||||
var
|
||||
a: int
|
||||
|
||||
a() #ERROR_MSG expression 'a()' cannot be called
|
||||
|
||||
|
||||
Reference in New Issue
Block a user