Locate 'attempt to redefine' errors at the import statement rather than at the first line of the imported module. Fixes #4541.
This commit is contained in:
parent
2605c8c4ce
commit
2bea2bdbbf
2 changed files with 7 additions and 3 deletions
|
|
@ -162,6 +162,10 @@ proc wrongRedefinition*(info: TLineInfo, s: string) =
|
|||
if gCmd != cmdInteractive:
|
||||
localError(info, errAttemptToRedefine, s)
|
||||
|
||||
proc addDecl*(c: PContext, sym: PSym, info: TLineInfo) =
|
||||
if not c.currentScope.addUniqueSym(sym):
|
||||
wrongRedefinition(info, sym.name.s)
|
||||
|
||||
proc addDecl*(c: PContext, sym: PSym) =
|
||||
if not c.currentScope.addUniqueSym(sym):
|
||||
wrongRedefinition(sym.info, sym.name.s)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue