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:
Timothee Cour 2020-10-27 15:19:28 +02:00 • committed by GitHub
commit 0fb878324e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 24 deletions

View file

@ -966,8 +966,9 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode =
# t.kind != tySequence(It is tyProc)
if typ.sym != nil and sfAnon notin typ.sym.flags and
typ.kind == tyProc:
msg.add(" = " &
typeToString(typ, preferDesc))
# when can `typ.sym != nil` ever happen?
msg.add(" = " & typeToString(typ, preferDesc))
msg.addDeclaredLocMaybe(c.config, typ)
localError(c.config, n.info, msg)
return errorNode(c, n)
result = nil