Diagnostic and cause
СсылкаInitializer reads a later binding
- Семейство
- topaz
- Этап
- resolve
- Код
TPZ3018
Причина и условия
During resolution, TPZ3018 reports a direct module initializer read of an uninitialized same-module runtime binding. See module initialization readiness and direct forward reads.
Действия
Move the dependency before the initializer. For work intended to happen later, call a function after initialization completes.
Compiler phase: resolve.
Compiler explanation: An imported-module initializer directly reads a later same-module runtime binding.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
- the initializer of
⟨value⟩reaches⟨value⟩, whose initializer has not completed (v5.2 defines no partially initialized module binding) Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ3018]: the initializer of
firstreachessecond, whose initializer has not completed (v5.2 defines no partially initialized module binding)
During resolution, TPZ3018 reports a direct module initializer read of an uninitialized same-module runtime binding. See module initialization readiness and direct forward reads.
Trigger and repair
During resolution, TPZ3018 reports a direct module initializer read of an uninitialized same-module runtime binding. See module initialization readiness and direct forward reads.
Response
СсылкаMove the dependency before the initializer. For work intended to happen later, call a function after initialization completes.
Reproduction and verification
СсылкаRejected program
Ссылкаimport lib
Нет стандартного вывода.export let first = secondlet second = 1
Ожидаемый результат
Ожидаемый результат
Этап отклонения resolve. Ненулевой код завершения.
diagnostic-tpz3018 at
lib.tpz:1:20
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
let second = 1export let first = second
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This program applies the repair described above. The verification status records whether it has been run.