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

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

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

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

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

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

    A concurrent timeout and else branch are not paired correctly.

    Diagnostic and cause

    Ссылка

    Malformed concurrent form

    Семейство
    topaz
    Этап
    parse
    Код
    TPZ2005

    Причина и условия

    A concurrent expression has an else block exactly when it has a timeout argument. Each arm has a name followed by : and an expression.

    Действия

    Remove the else block for concurrent without a timeout. When selecting a timeout, write timeout: followed by a duration and provide an else block.

    Compiler phase: parse.

    Compiler explanation: A concurrent timeout and else branch are not paired correctly.

    Message templates. The marker ⟨value⟩ stands for text computed for the reported program.

    • concurrent takes only a timeout: argument Source
    • else requires the concurrent(timeout: ...) form Source
    • the concurrent(timeout: ...) form requires an else block Source

    The reproduction attaches an else block to concurrent without a timeout. The timeout form requires an else block, and the form without a timeout rejects one.

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

    Trigger and repair

    A concurrent expression has an else block exactly when it has a timeout argument. Each arm has a name followed by : and an expression.

    Response

    Ссылка

    Remove the else block for concurrent without a timeout. When selecting a timeout, write timeout: followed by a duration and provide an else block.

    Reproduction and verification

    Ссылка

    Rejected program

    Ссылка
    example.tpzRejected programОткрыть песочницу →
    1. let value = concurrent { first: 1 } else { 0 }
    Ожидаемый выводНенулевой код завершения
    Нет стандартного вывода.
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

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

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

    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. let value = concurrent { first: 1 }
    Ожидаемый выводКод завершения 0
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

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

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

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

    Меню

    Загрузка →