Diagnostic and cause
LinkMalformed import list
- Family
- topaz
- Phase
- parse
- Code
TPZ2011
Cause and conditions
Each exported name and each resulting local binding appears at most once in a nonempty selected import list.
Related rule: Trigger and repairResponse
Remove repeated selections. Select at least one identifier and give different exported names distinct local aliases.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 310-318 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1047-1047 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1039-1077 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1080-1111 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1114-1131 - TPZ2011 at
151141d7bb44
Compiler phase: parse.
Compiler explanation: An import selection list is empty, duplicate, or contains an invalid name.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
- an import name is an identifier; keywords cannot be selected Source
- this exported name is already selected in this list Source
- this local name is already bound by this list Source
- a selection list selects at least one exported name Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ2011]: this exported name is already selected in this list
The selection list repeats an exported name. A selected import list must be nonempty, and both exported names and local aliases must be unique. Keywords cannot be selected as names.
Trigger and repair
Each exported name and each resulting local binding appears at most once in a nonempty selected import list.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1039-1077 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1080-1111 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1114-1131 - TPZ2011 at
151141d7bb44
Response
LinkRemove repeated selections. Select at least one identifier and give different exported names distinct local aliases.
Reproduction and verification
LinkRejected program
Linkimport lib { value, value }
No stdout.
export let value = 1
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· 310-318 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1047-1047 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1039-1077 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1080-1111 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1114-1131 - TPZ2011 at
151141d7bb44
Corrected program
Linkimport lib { value }
export let value = 1
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/parser/declarations_modules.tpz at
151141d7bb44· 1039-1077 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1080-1111 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1114-1131 - TPZ2011 at
151141d7bb44