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

@ -154,12 +154,14 @@ type
scope*: PScope
inSymChoice: IntSet
proc getSymRepr*(conf: ConfigRef; s: PSym): string =
proc getSymRepr*(conf: ConfigRef; s: PSym, getDeclarationPath = true): string =
case s.kind
of routineKinds, skType:
result = getProcHeader(conf, s)
result = getProcHeader(conf, s, getDeclarationPath = getDeclarationPath)
else:
result = s.name.s
result = "'$1'" % s.name.s
if getDeclarationPath:
result.addDeclaredLoc(conf, s)
proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) =
# check if all symbols have been used and defined:
@ -172,7 +174,7 @@ proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) =
# and slow 'suggest' down:
if missingImpls == 0:
localError(c.config, s.info, "implementation of '$1' expected" %
getSymRepr(c.config, s))
getSymRepr(c.config, s, getDeclarationPath=false))
inc missingImpls
elif {sfUsed, sfExported} * s.flags == {}:
if s.kind notin {skForVar, skParam, skMethod, skUnknown, skGenericParam, skEnumField}: