Skip to content

Missing DuplicateModuleImport hint when modules share base filenames #24998

Open
@tersec

Description

@tersec

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions