Fixes #5112
This commit is contained in:
parent
454547da8e
commit
b6b5a11be7
5 changed files with 18 additions and 3 deletions
|
|
@ -133,11 +133,12 @@ proc newModule(graph: ModuleGraph; fileIdx: int32): PSym =
|
||||||
rawMessage(errInvalidModuleName, result.name.s)
|
rawMessage(errInvalidModuleName, result.name.s)
|
||||||
|
|
||||||
result.info = newLineInfo(fileIdx, 1, 1)
|
result.info = newLineInfo(fileIdx, 1, 1)
|
||||||
let pack = getIdent(getPackageName(filename))
|
let
|
||||||
|
pck = getPackageName(filename)
|
||||||
|
pck2 = if pck.len > 0: pck else: "unknown"
|
||||||
|
pack = getIdent(pck2)
|
||||||
var packSym = graph.packageSyms.strTableGet(pack)
|
var packSym = graph.packageSyms.strTableGet(pack)
|
||||||
if packSym == nil:
|
if packSym == nil:
|
||||||
let pck = getPackageName(filename)
|
|
||||||
let pck2 = if pck.len > 0: pck else: "unknown"
|
|
||||||
packSym = newSym(skPackage, getIdent(pck2), nil, result.info)
|
packSym = newSym(skPackage, getIdent(pck2), nil, result.info)
|
||||||
initStrTable(packSym.tab)
|
initStrTable(packSym.tab)
|
||||||
graph.packageSyms.strTableAdd(packSym)
|
graph.packageSyms.strTableAdd(packSym)
|
||||||
|
|
|
||||||
0
tests/modules/mnotuniquename.nim
Normal file
0
tests/modules/mnotuniquename.nim
Normal file
7
tests/modules/tnotuniquename.nim
Normal file
7
tests/modules/tnotuniquename.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
discard """
|
||||||
|
file: "tnotuniquename/mnotuniquename.nim"
|
||||||
|
errormsg: "module names need to be unique per Nimble package"
|
||||||
|
"""
|
||||||
|
|
||||||
|
import mnotuniquename
|
||||||
|
import tnotuniquename/mnotuniquename as nun
|
||||||
0
tests/modules/tnotuniquename/mnotuniquename.nim
Normal file
0
tests/modules/tnotuniquename/mnotuniquename.nim
Normal file
7
tests/modules/tnotuniquename2.nim
Normal file
7
tests/modules/tnotuniquename2.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
discard """
|
||||||
|
file: "tnotuniquename/mnotuniquename.nim"
|
||||||
|
errormsg: "module names need to be unique per Nimble package"
|
||||||
|
"""
|
||||||
|
|
||||||
|
import mnotuniquename
|
||||||
|
import tnotuniquename/mnotuniquename
|
||||||
Loading…
Add table
Add a link
Reference in a new issue