Diagnostic and cause
СсылкаImported module exports nothing
- Семейство
- topaz
- Этап
- resolve
- Код
TPZ3010
Причина и условия
Historical SELF behavior: importing a module with no exported declarations produces TPZ3010. The recommended Modules contract permits an empty-export namespace import and uses TPZ3009 when an absent member is selected. The namespace acceptance and current-product limitation on the Modules page are the normative /v6.0/en/docs expectations for that decision; the reproduction below preserves the historical diagnostic identity.
Связанное правило · Trigger and repair →Действия
For the current SELF product, put initialization in the entry or expose a real public operation that the application needs. The recommended contract requires no dummy export: an ordinary namespace import can initialize a module with no public members. TPZ3010 remains reserved for the historical restriction and is not reassigned.
Compiler phase: resolve.
Compiler explanation: A module import targets a module with no exported surface.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
⟨value⟩exports nothing; v5.2 has no side-effect-only imports Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ3010]:
libexports nothing; v5.2 has no side-effect-only imports
Historical SELF restriction: the imported module has an empty export table. The recommended uniform module contract permits that namespace import and initializes the module normally.
Trigger and repair
Historical SELF behavior: importing a module with no exported declarations produces TPZ3010. The recommended Modules contract permits an empty-export namespace import and uses TPZ3009 when an absent member is selected. The namespace acceptance and current-product limitation on the Modules page are the normative /v6.0/en/docs expectations for that decision; the reproduction below preserves the historical diagnostic identity.
Response
СсылкаFor the current SELF product, put initialization in the entry or expose a real public operation that the application needs. The recommended contract requires no dummy export: an ordinary namespace import can initialize a module with no public members. TPZ3010 remains reserved for the historical restriction and is not reassigned.
Reproduction and verification
СсылкаRejected program
Ссылкаimport lib
Нет стандартного вывода.let privateValue = 1
Ожидаемый результат
Ожидаемый результат
Этап отклонения resolve. Ненулевой код завершения.
diagnostic-tpz3010 at
example.tpz:1: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
export let privateValue = 1
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This program applies the repair described above. The verification status records whether it has been run.