Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Missing `DuplicateModuleImport` hint when modules share base filenames

Open tersec opened this issue 4 months ago • 0 comments

Nim Version

Nim Compiler Version 2.2.4 [Linux: amd64]
Compiled at 2025-06-08
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: f7145dd26efeeeb6eeae6fff649db244d81b212d
active boot switches: -d:release
Nim Compiler Version 2.2.5 [Linux: amd64]
Compiled at 2025-06-15
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: 7fdbdb2f20a9d43e62afac8c32dfd3a3e39d3149
active boot switches: -d:release
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-06-15
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: 7701b3c7e6f6c640a89cc445b40f466834ab4fcf
active boot switches: -d:release

Description

import ./n/r
import ./j/r
import ./n/r

where all such imported modules n/r.nim and j/r.nim can be empty files.

Current Output

/tmp/v.nim(1, 12) Warning: imported and not used: 'r' [UnusedImport]
/tmp/v.nim(2, 12) Warning: imported and not used: 'r' [UnusedImport]
/tmp/v.nim(3, 12) Warning: imported and not used: 'r' [UnusedImport]

Expected Output

/tmp/v.nim(3, 12) Hint: duplicate import of 'r'; previous import here: /tmp/v.nim(1, 12) [DuplicateModuleImport]
to be somewhere

Known Workarounds

No response

Additional Information

No response

tersec avatar Jun 15 '25 20:06 tersec