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

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

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

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

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

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

    An exported let pattern must bind at least one name.

    Diagnostic and cause

    Ссылка

    Invalid exported let pattern

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

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

    An exported let uses the ordinary immutable let pattern rules and publishes every bound name. A pattern with no bound name is rejected with TPZ2007 during parsing.

    Действия

    Remove export when no name is published, or bind the names that callers need with an ordinary immutable let pattern.

    The 6.0 contract rejects exported patterns without a bound name. The following message and observation describe the historical 5.21.3 single-identifier restriction. They do not prohibit destructuring in Topaz 6.0.

    Compiler phase: parse.

    Compiler explanation: An exported let declaration uses a pattern other than one identifier.

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

    • an exported let binds exactly one identifier; destructure privately, then export the identifier Source

    An exported let pattern binds no name. Use export for one or more ordinary immutable pattern bindings.

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

    Trigger and repair

    An exported let uses the ordinary immutable let pattern rules and publishes every bound name. A pattern with no bound name is rejected with TPZ2007 during parsing.

    Response

    Ссылка

    Remove export when no name is published, or bind the names that callers need with an ordinary immutable let pattern.

    Reproduction and verification

    Ссылка

    Rejected program

    Ссылка
    example.tpzRejected programОткрыть песочницу →
    1. export let _ = 1
    Ожидаемый выводНенулевой код завершения
    Нет стандартного вывода.
    $ topaz check example.tpz --format json · Целевой продукт 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 _ = 1
    Ожидаемый выводКод завершения 0
    $ topaz check example.tpz --format json · Целевой продукт 5.21.3
    Ожидаемый результат

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

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

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

    Меню

    Загрузка →