followup #17777: declaredloc field error msgs now work with generics (#18259)

* followup #17777: declaredloc field error msgs now work with generics

* fix tests

* cleanup
This commit is contained in:
Timothee Cour 2021-06-13 23:21:18 -07:00 • committed by GitHub
commit 065243dc59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 17 deletions

View file

@ -2,6 +2,11 @@
import std/strutils
import options, ast, msgs
proc typSym*(t: PType): PSym =
result = t.sym
if result == nil and t.kind == tyGenericInst: # this might need to be refined
result = t[0].sym
proc addDeclaredLoc*(result: var string, conf: ConfigRef; sym: PSym) =
result.add " [$1 declared in $2]" % [sym.kind.toHumanStr, toFileLineCol(conf, sym.info)]