fixes #588
This commit is contained in:
parent
275c7ccf82
commit
4d86b8a83c
2 changed files with 14 additions and 12 deletions
|
|
@ -34,13 +34,12 @@ proc sameMethodDispatcher(a, b: PSym): bool =
|
||||||
|
|
||||||
proc determineType(c: PContext, s: PSym)
|
proc determineType(c: PContext, s: PSym)
|
||||||
|
|
||||||
proc
|
proc pickBestCandidate(c: PContext, headSymbol: PNode,
|
||||||
pickBestCandidate(c: PContext, headSymbol: PNode,
|
n, orig: PNode,
|
||||||
n, orig: PNode,
|
initialBinding: PNode,
|
||||||
initialBinding: PNode,
|
filter: TSymKinds,
|
||||||
filter: TSymKinds,
|
best, alt: var TCandidate,
|
||||||
best, alt: var TCandidate,
|
errors: var seq[string]) =
|
||||||
errors: var seq[string]) =
|
|
||||||
var o: TOverloadIter
|
var o: TOverloadIter
|
||||||
var sym = initOverloadIter(o, c, headSymbol)
|
var sym = initOverloadIter(o, c, headSymbol)
|
||||||
var symScope = o.lastOverloadScope
|
var symScope = o.lastOverloadScope
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ proc semOperand(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
|
||||||
|
|
||||||
proc semExprWithType(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
|
proc semExprWithType(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
|
||||||
result = semExpr(c, n, flags)
|
result = semExpr(c, n, flags)
|
||||||
if result.kind == nkEmpty:
|
if result.isNil or result.kind == nkEmpty:
|
||||||
# do not produce another redundant error message:
|
# do not produce another redundant error message:
|
||||||
#raiseRecoverableError("")
|
#raiseRecoverableError("")
|
||||||
result = errorNode(c, n)
|
result = errorNode(c, n)
|
||||||
|
|
@ -786,9 +786,11 @@ proc semEcho(c: PContext, n: PNode): PNode =
|
||||||
checkMinSonsLen(n, 1)
|
checkMinSonsLen(n, 1)
|
||||||
for i in countup(1, sonsLen(n) - 1):
|
for i in countup(1, sonsLen(n) - 1):
|
||||||
var arg = semExprWithType(c, n.sons[i])
|
var arg = semExprWithType(c, n.sons[i])
|
||||||
n.sons[i] = semExprWithType(c, buildStringify(c, arg))
|
arg = semExprWithType(c, buildStringify(c, arg))
|
||||||
let t = n.sons[i].typ
|
n.sons[i] = arg
|
||||||
if t == nil or t.skipTypes(abstractInst).kind != tyString:
|
let t = arg.typ
|
||||||
|
if (t == nil or t.skipTypes(abstractInst).kind != tyString) and
|
||||||
|
arg.kind != nkEmpty:
|
||||||
LocalError(n.info, errGenerated,
|
LocalError(n.info, errGenerated,
|
||||||
"implicitly invoked '$' does not return string")
|
"implicitly invoked '$' does not return string")
|
||||||
let t = n.sons[0].typ
|
let t = n.sons[0].typ
|
||||||
|
|
@ -807,7 +809,8 @@ proc buildEchoStmt(c: PContext, n: PNode): PNode =
|
||||||
var arg = buildStringify(c, n)
|
var arg = buildStringify(c, n)
|
||||||
# problem is: implicit '$' is not checked for semantics yet. So we give up
|
# problem is: implicit '$' is not checked for semantics yet. So we give up
|
||||||
# and check 'arg' for semantics again:
|
# and check 'arg' for semantics again:
|
||||||
addSon(result, semExpr(c, arg))
|
arg = semExpr(c, arg)
|
||||||
|
if arg != nil: addSon(result, arg)
|
||||||
|
|
||||||
proc semExprNoType(c: PContext, n: PNode): PNode =
|
proc semExprNoType(c: PContext, n: PNode): PNode =
|
||||||
result = semExpr(c, n, {efWantStmt})
|
result = semExpr(c, n, {efWantStmt})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue