Перейти к содержимому
Топаз6.0 · До релиза
Загрузка →

Поиск в документации

Спецификация 6.0

Выберите результат стрелками и нажмите Enter, чтобы открыть его.

Введите имя API, номер диагностики, правило или тему проекта.

    Диагностика TPZ3018

    An imported-module initializer directly reads a later same-module runtime binding.

    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 first reaches second, 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.

    Правилоdiagnostics.tpz3018.rule

    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

    Ссылка
    example.tpzRejected programОткрыть песочницу →
    1. import lib
    Ожидаемый выводНенулевой код завершения
    Нет стандартного вывода.
    $ topaz check example.tpz · Целевой продукт 5.21.3
    lib.tpzRejected programОткрыть песочницу →
    1. export let first = second
    2. let second = 1
    Ожидаемый результат

    Ожидаемый результат

    Этап отклонения resolve. Ненулевой код завершения.

    The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.

    Corrected program

    Ссылка
    example.tpzCorrected programОткрыть песочницу →
    1. import lib
    Ожидаемый выводКод завершения 0
    $ topaz check example.tpz · Целевой продукт 5.21.3
    lib.tpzCorrected programОткрыть песочницу →
    1. let second = 1
    2. export let first = second
    Ожидаемый результат

    Ожидаемый результат

    Проверка принимает программу. Код завершения 0.

    This program applies the repair described above. The verification status records whether it has been run.

    Меню

    Загрузка →