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.
Связанное правило · Duplicate protocol implementation →Действия
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]:
Itemconformance toShowis 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.
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
Ссылкаrecord Item derives Show, Show { value: int }
Нет стандартного вывода.Ожидаемый результат
Ожидаемый результат
Этап отклонения check. Ненулевой код завершения.
diagnostic-tpz5521 at
example.tpz:1:27
Repaired program
Ссылкаrecord Item derives Show { value: int }
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.