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 }
표준 출력 없음.기대 결과
Repaired program
링크record Item derives Show { value: int }
기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.