honor --declaredLocs in more places, including type mismatch errors; also show kind with --declaredLocs (#15673)
* honor --declaredLocs in more places, including type mismatch errors * fix tests * show declaration location also when type mismatch names clash
This commit is contained in:
parent
218acfe367
commit
0fb878324e
7 changed files with 40 additions and 24 deletions
|
|
@ -231,8 +231,7 @@ proc presentFailedCandidates(c: PContext, n: PNode, errors: CandidateErrors):
|
|||
doAssert err.firstMismatch.formal != nil
|
||||
candidates.add("\n required type for " & nameParam & ": ")
|
||||
candidates.add typeToString(wanted)
|
||||
if wanted.sym != nil:
|
||||
candidates.addDeclaredLocMaybe(c.config, wanted.sym)
|
||||
candidates.addDeclaredLocMaybe(c.config, wanted)
|
||||
candidates.add "\n but expression '"
|
||||
if err.firstMismatch.kind == kVarNeeded:
|
||||
candidates.add renderNotLValue(nArg)
|
||||
|
|
@ -242,9 +241,7 @@ proc presentFailedCandidates(c: PContext, n: PNode, errors: CandidateErrors):
|
|||
candidates.add "' is of type: "
|
||||
var got = nArg.typ
|
||||
candidates.add typeToString(got)
|
||||
if got.sym != nil:
|
||||
candidates.addDeclaredLocMaybe(c.config, got.sym)
|
||||
|
||||
candidates.addDeclaredLocMaybe(c.config, got)
|
||||
doAssert wanted != nil
|
||||
if got != nil: effectProblem(wanted, got, candidates, c)
|
||||
of kUnknown: discard "do not break 'nim check'"
|
||||
|
|
@ -320,7 +317,7 @@ proc getMsgDiagnostic(c: PContext, flags: TExprFlags, n, f: PNode): string =
|
|||
var o: TOverloadIter
|
||||
var sym = initOverloadIter(o, c, f)
|
||||
while sym != nil:
|
||||
result &= "\n found '$1' of kind '$2'" % [getSymRepr(c.config, sym), sym.kind.toHumanStr]
|
||||
result &= "\n found $1" % [getSymRepr(c.config, sym)]
|
||||
sym = nextOverloadIter(o, c, f)
|
||||
|
||||
let ident = considerQuotedIdent(c, f, n).s
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue