Diagnostic and cause
СсылкаDuplicate import
- Семейство
- topaz
- Этап
- resolve
- Код
TPZ3017
Причина и условия
Importing the same logical module twice from one module produces TPZ3017, including imports that select different names.
Связанное правило · Trigger and repair →Действия
Combine the selected names into one import declaration or use one namespace import.
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.
Response
СсылкаCombine the selected names into one import declaration or use one namespace import.
Reproduction and verification
СсылкаRejected program
Ссылкаimport lib { first }import lib { second }
Нет стандартного вывода.export let first = 1export let second = 2
Ожидаемый результат
Ожидаемый результат
Этап отклонения resolve. Ненулевой код завершения.
diagnostic-tpz3017 at
example.tpz:2:8
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Corrected program
Ссылкаimport lib { first, second }
export let first = 1export let second = 2
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This program applies the repair described above. The verification status records whether it has been run.