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.
관련 규칙 · Protocol cannot be derived for this type →대응
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⟩inderivesfor⟨value⟩; derivable protocols areEq,Order,Show,JSONSource
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ5530]: cannot derive
EqforCallback: fieldactionhas a non-comparable type
Deriving Eq requires every contained field type to support equality. A function-valued field prevents Eq derivation and produces TPZ5530.
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
링크record Callback derives Eq { action: () -> int }
표준 출력 없음.기대 결과
Repaired program
링크record Callback derives Eq { action: int }
기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.