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

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

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

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

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

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

    A derives clause asks for generated protocol behavior that this type's fields or payloads cannot support.

    Diagnostic and cause

    Ссылка

    Protocol cannot be derived for this type

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

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

    Deriving Eq requires every contained field type to support equality. A function-valued field prevents Eq derivation and produces TPZ5530.

    Действия

    Use a supported derives protocol and compatible stored types. Remove the clause or write an admitted manual implementation where that protocol permits one.

    Compiler phase: check.

    Compiler explanation: A derives clause asks for generated protocol behavior that this type's fields or payloads cannot support.

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

    • unknown protocol ⟨value⟩ in derives for ⟨value⟩; derivable protocols are Eq, Order, Show, JSON Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ5530]: cannot derive Eq for Callback: field action has a non-comparable type

    Deriving Eq requires every contained field type to support equality. A function-valued field prevents Eq derivation and produces TPZ5530.

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

    Protocol cannot be derived for this type

    Deriving Eq requires every contained field type to support equality. A function-valued field prevents Eq derivation and produces TPZ5530.

    Response

    Ссылка

    Use a supported derives protocol and compatible stored types. Remove the clause or write an admitted manual implementation where that protocol permits one.

    Reproduction and verification

    Ссылка

    Rejected program

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

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

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

    Repaired program

    Ссылка
    example.tpzRepaired program
    1. record Callback derives Eq { action: int }
    Ожидаемый выводКод завершения 0
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

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

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

    Меню

    Загрузка →