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

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

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

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

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

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

    A variadic function type or parameter list puts the variadic slot before another slot.

    Diagnostic and cause

    Ссылка

    Variadic parameter is not final

    Семейство
    topaz
    Этап
    check
    Код
    TPZ5024

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

    A variadic parameter must be the final parameter of its declaration or function type.

    Действия

    Move the variadic parameter to the end of the declaration or function type.

    Compiler phase: check.

    Compiler explanation: A variadic function type or parameter list puts the variadic slot before another slot.

    Message templates are Pending. The explanation above is not an observed CLI message.

    A variadic parameter must be the final parameter of its declaration or function type.

    Правилоdiagnostics.tpz5024.p5.rule

    Variadic parameter is not final

    A variadic parameter must be the final parameter of its declaration or function type.

    Response

    Ссылка

    Move the variadic parameter to the end of the declaration or function type.

    Reproduction and verification

    Ссылка

    Rejected program

    Ссылка
    example.tpzRejected programОткрыть песочницу →
    1. function tail(...values: int, last: int) -> int { last }
    Ожидаемый выводНенулевой код завершения
    Нет стандартного вывода.
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

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

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

    Контракт обязательного основного местоположения не определён.

    The intended rejection is recorded as an implementation limitation. A current SELF producer does not establish the diagnostic source location, so that location remains Pending.

    Repaired program

    Ссылка
    example.tpzRepaired program
    1. function tail(last: int, ...values: int) -> int { last }
    Ожидаемый выводКод завершения 0
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

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

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

    The intended rejection is recorded as an implementation limitation. A current SELF producer does not establish the diagnostic source location, so that location remains Pending.

    Меню

    Загрузка →