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

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

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

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

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

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

    The same type already conforms to the same protocol.

    Diagnostic and cause

    Ссылка

    Duplicate protocol implementation

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

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

    Each nominal type has at most one conformance to a given protocol. Repeating a derives entry or adding another implementation of the same conformance is rejected with TPZ5521.

    Действия

    Keep one implementation of the protocol for that type. Remove the duplicate derives entry or manual implementation.

    Compiler phase: check.

    Compiler explanation: The same type already conforms to the same protocol.

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

    • ⟨value⟩ conformance to ⟨value⟩ ⟨value⟩; a conformance must be unique Source
    • ⟨value⟩ already conforms to ⟨value⟩ ⟨value⟩; a conformance must be unique Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ5521]: Item conformance to Show is derived more than once; a conformance must be unique

    Each nominal type has at most one conformance to a given protocol. Repeating a derives entry or adding another implementation of the same conformance is rejected with TPZ5521.

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

    Duplicate protocol implementation

    Each nominal type has at most one conformance to a given protocol. Repeating a derives entry or adding another implementation of the same conformance is rejected with TPZ5521.

    Response

    Ссылка

    Keep one implementation of the protocol for that type. Remove the duplicate derives entry or manual implementation.

    Reproduction and verification

    Ссылка

    Rejected program

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

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

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

    Repaired program

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

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

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

    Меню

    Загрузка →