Diagnostic and cause
LinkDuplicate import
- Family
- topaz
- Phase
- resolve
- Code
TPZ3017
Cause and conditions
Importing the same logical module twice from one module produces TPZ3017, including imports that select different names.
Related rule: Trigger and repairResponse
Combine the selected names into one import declaration or use one namespace import.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 490-498 - compiler/crates/topaz_self_frontend/topaz/resolver/graph.tpz at
151141d7bb44· 714-714 - compiler/crates/topaz_self_frontend/topaz/resolver/graph.tpz at
151141d7bb44· 702-723 - TPZ3017 at
151141d7bb44
Compiler phase: resolve.
Compiler explanation: The same logical module is imported more than once in one module.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
⟨value⟩is already imported by this module; a logical module may appear in at most one import item Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ3017]:
libis already imported by this module; a logical module may appear in at most one import item
The module already has an import for the same logical dependency. Different selection lists do not create distinct dependencies.
Trigger and repair
Importing the same logical module twice from one module produces TPZ3017, including imports that select different names.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/resolver/graph.tpz at
151141d7bb44· 702-723 - TPZ3017 at
151141d7bb44
Response
LinkCombine the selected names into one import declaration or use one namespace import.
Reproduction and verification
LinkRejected program
Linkimport lib { first }import lib { second }
No stdout.
export let first = 1export let second = 2
Expected result
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 490-498 - compiler/crates/topaz_self_frontend/topaz/resolver/graph.tpz at
151141d7bb44· 714-714 - compiler/crates/topaz_self_frontend/topaz/resolver/graph.tpz at
151141d7bb44· 702-723 - TPZ3017 at
151141d7bb44
Corrected program
Linkimport lib { first, second }
export let first = 1export let second = 2
Expected result
Expected result
Checking accepts the program. Exit code 0.
This program applies the repair described above. The verification status records whether it has been run.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/resolver/graph.tpz at
151141d7bb44· 702-723 - TPZ3017 at
151141d7bb44