Diagnostic and cause
링크Non-exhaustive match
- 계열
- topaz
- 단계
- check
- 코드
TPZ5021
원인과 조건
TPZ4006 is retired in Topaz 6.0.0. Its code and former meaning, runtime match failure, remain reserved and must not be reused. An incomplete match produces TPZ5021 during checking under match exhaustiveness.
관련 규칙 · Reserved runtime code and current checking diagnostic →Every match must satisfy match exhaustiveness during checking. A missing case or a missing final unconditional arm produces TPZ5021 at the match expression.
관련 규칙 · Non-exhaustive match →대응
Add arms for the missing cases or an appropriate wildcard arm. Keep error and empty cases explicit when they require different behavior.
Compiler phase: check.
Compiler explanation: A match expression does not cover every known case of the scrutinee type.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
- non-exhaustive match: missing ⟨value⟩ Source
A match does not satisfy match exhaustiveness. Closed cases include nested closed payloads. Open input types require a final unguarded wildcard or name pattern. Guarded arms do not establish coverage.
Non-exhaustive match
Every match must satisfy match exhaustiveness during checking. A missing case or a missing final unconditional arm produces TPZ5021 at the match expression.
이유
Checking every match removes a separate runtime failure for missing cases. The same diagnostic covers closed cases and open inputs.
Response
링크Add arms for the missing cases or an appropriate wildcard arm. Keep error and empty cases explicit when they require different behavior.
Reproduction and verification
링크Rejected program
링크function classify(value: bool) -> int {match (value) {case true => 1}}let result = classify(true)
표준 출력 없음.기대 결과
Repaired program
링크function classify(value: bool) -> int {match (value) {case true => 1case false => 0}}let result = classify(true)
기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.