Skip to content

Commit 3226d05

Browse files
committed
fix tests
1 parent 39d7663 commit 3226d05

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

compiler/lookups.nim

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,14 @@ type
154154
scope*: PScope
155155
inSymChoice: IntSet
156156

157-
proc getSymRepr*(conf: ConfigRef; s: PSym): string =
157+
proc getSymRepr*(conf: ConfigRef; s: PSym, getDeclarationPath = true): string =
158158
case s.kind
159159
of routineKinds, skType:
160-
result = getProcHeader(conf, s)
160+
result = getProcHeader(conf, s, getDeclarationPath = getDeclarationPath)
161161
else:
162-
result = s.name.s
162+
result = "'$1'" % s.name.s
163+
if getDeclarationPath:
164+
result.addDeclaredLoc(conf, s)
163165

164166
proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) =
165167
# check if all symbols have been used and defined:
@@ -172,7 +174,7 @@ proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) =
172174
# and slow 'suggest' down:
173175
if missingImpls == 0:
174176
localError(c.config, s.info, "implementation of '$1' expected" %
175-
getSymRepr(c.config, s))
177+
getSymRepr(c.config, s, getDeclarationPath=false))
176178
inc missingImpls
177179
elif {sfUsed, sfExported} * s.flags == {}:
178180
if s.kind notin {skForVar, skParam, skMethod, skUnknown, skGenericParam, skEnumField}:

compiler/semcall.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ proc getMsgDiagnostic(c: PContext, flags: TExprFlags, n, f: PNode): string =
317317
var o: TOverloadIter
318318
var sym = initOverloadIter(o, c, f)
319319
while sym != nil:
320-
result &= "\n found '$1'" % [getSymRepr(c.config, sym)]
320+
result &= "\n found $1" % [getSymRepr(c.config, sym)]
321321
sym = nextOverloadIter(o, c, f)
322322

323323
let ident = considerQuotedIdent(c, f, n).s

tests/errmsgs/t8794.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ discard """
22
cmd: "nim check $options $file"
33
errormsg: ""
44
nimout: '''
5-
t8794.nim(39, 27) Error: undeclared field: 'a3' for type m8794.Foo3 [declared in m8794.nim(1, 6)]
5+
t8794.nim(39, 27) Error: undeclared field: 'a3' for type m8794.Foo3 [type declared in m8794.nim(1, 6)]
66
'''
77
"""
88

tests/misc/tnoop.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
discard """
22
nimout: '''
3-
found 'a' of kind 'var'
3+
found 'a' [var declared in tnoop.nim(11, 3)]
44
'''
55
file: "tnoop.nim"
66
line: 13

0 commit comments

Comments
 (0)