parent
b35ee82c48
commit
27e32e0a7d
1 changed files with 12 additions and 9 deletions
|
|
@ -169,21 +169,24 @@ proc presentFailedCandidates(c: PContext, n: PNode, errors: CandidateErrors):
|
||||||
else:
|
else:
|
||||||
add(candidates, err.sym.getProcHeader(prefer))
|
add(candidates, err.sym.getProcHeader(prefer))
|
||||||
add(candidates, "\n")
|
add(candidates, "\n")
|
||||||
if err.firstMismatch != 0 and n.len > 2:
|
if err.firstMismatch != 0 and n.len > 1:
|
||||||
add(candidates, " first type mismatch at position: " & $err.firstMismatch &
|
let cond = n.len > 2
|
||||||
"\n required type: ")
|
if cond:
|
||||||
|
candidates.add(" first type mismatch at position: " & $err.firstMismatch &
|
||||||
|
"\n required type: ")
|
||||||
var wanted, got: PType = nil
|
var wanted, got: PType = nil
|
||||||
if err.firstMismatch < err.sym.typ.len:
|
if err.firstMismatch < err.sym.typ.len:
|
||||||
wanted = err.sym.typ.sons[err.firstMismatch]
|
wanted = err.sym.typ.sons[err.firstMismatch]
|
||||||
candidates.add typeToString(wanted)
|
if cond: candidates.add typeToString(wanted)
|
||||||
else:
|
else:
|
||||||
candidates.add "none"
|
if cond: candidates.add "none"
|
||||||
if err.firstMismatch < n.len:
|
if err.firstMismatch < n.len:
|
||||||
candidates.add "\n but expression '"
|
if cond:
|
||||||
candidates.add renderTree(n[err.firstMismatch])
|
candidates.add "\n but expression '"
|
||||||
candidates.add "' is of type: "
|
candidates.add renderTree(n[err.firstMismatch])
|
||||||
|
candidates.add "' is of type: "
|
||||||
got = n[err.firstMismatch].typ
|
got = n[err.firstMismatch].typ
|
||||||
candidates.add typeToString(got)
|
if cond: candidates.add typeToString(got)
|
||||||
if wanted != nil and got != nil:
|
if wanted != nil and got != nil:
|
||||||
effectProblem(wanted, got, candidates)
|
effectProblem(wanted, got, candidates)
|
||||||
candidates.add "\n"
|
candidates.add "\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue