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
기대 결과
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.