Remove duplicate line number from 'invalid forward declaration' error (#11966)
This commit is contained in:
parent
15e681ce66
commit
cf09ef47b8
3 changed files with 8 additions and 7 deletions
|
|
@ -72,8 +72,8 @@ proc searchForProcNew(c: PContext, scope: PScope, fn: PSym): PSym =
|
||||||
of paramsEqual:
|
of paramsEqual:
|
||||||
if (sfExported notin result.flags) and (sfExported in fn.flags):
|
if (sfExported notin result.flags) and (sfExported in fn.flags):
|
||||||
let message = ("public implementation '$1' has non-public " &
|
let message = ("public implementation '$1' has non-public " &
|
||||||
"forward declaration in $2") %
|
"forward declaration at $2") %
|
||||||
[getProcHeader(c.config, result), c.config$result.info]
|
[getProcHeader(c.config, result, getDeclarationPath = false), c.config$result.info]
|
||||||
localError(c.config, fn.info, message)
|
localError(c.config, fn.info, message)
|
||||||
return
|
return
|
||||||
of paramsIncompatible:
|
of paramsIncompatible:
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ proc isIntLit*(t: PType): bool {.inline.} =
|
||||||
proc isFloatLit*(t: PType): bool {.inline.} =
|
proc isFloatLit*(t: PType): bool {.inline.} =
|
||||||
result = t.kind == tyFloat and t.n != nil and t.n.kind == nkFloatLit
|
result = t.kind == tyFloat and t.n != nil and t.n.kind == nkFloatLit
|
||||||
|
|
||||||
proc getProcHeader*(conf: ConfigRef; sym: PSym; prefer: TPreferedDesc = preferName): string =
|
proc getProcHeader*(conf: ConfigRef; sym: PSym; prefer: TPreferedDesc = preferName; getDeclarationPath = true): string =
|
||||||
assert sym != nil
|
assert sym != nil
|
||||||
result = sym.owner.name.s & '.' & sym.name.s
|
result = sym.owner.name.s & '.' & sym.name.s
|
||||||
if sym.kind in routineKinds:
|
if sym.kind in routineKinds:
|
||||||
|
|
@ -137,9 +137,10 @@ proc getProcHeader*(conf: ConfigRef; sym: PSym; prefer: TPreferedDesc = preferNa
|
||||||
add(result, ')')
|
add(result, ')')
|
||||||
if n.sons[0].typ != nil:
|
if n.sons[0].typ != nil:
|
||||||
result.add(": " & typeToString(n.sons[0].typ, prefer))
|
result.add(": " & typeToString(n.sons[0].typ, prefer))
|
||||||
result.add " [declared in "
|
if getDeclarationPath:
|
||||||
result.add(conf$sym.info)
|
result.add " [declared in "
|
||||||
result.add "]"
|
result.add(conf$sym.info)
|
||||||
|
result.add "]"
|
||||||
|
|
||||||
proc elemType*(t: PType): PType =
|
proc elemType*(t: PType): PType =
|
||||||
assert(t != nil)
|
assert(t != nil)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
errormsg: "public implementation 'tmismatchedvisibility.foo(a: int) [declared in tmismatchedvisibility.nim(6, 6)]' has non-public forward declaration in "
|
errormsg: "public implementation 'tmismatchedvisibility.foo(a: int)' has non-public forward declaration at "
|
||||||
line: 8
|
line: 8
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue