Diagnostic and cause
LinkMatch missed at runtime
- Family
- topaz
- Phase
- run
- Code
TPZ4006
Cause and conditions
Response
Make the match exhaustive. Open input types need a final unguarded wildcard or name pattern.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 553-561 - compiler/crates/topaz_product_runtime/src/diagnostic.rs at
151141d7bb44· 59-59 - compiler/crates/topaz_value/src/lib.rs at
151141d7bb44· 166-166 - issues/31 at
1cbf38d3d422 - compiler/crates/topaz_product_runtime/src/runtime/flow.rs at
151141d7bb44· 355-390 - compiler/crates/topaz_product_runtime/src/runtime/flow.rs at
151141d7bb44· 460-476 - compiler/crates/topaz_product_runtime/src/diagnostic.rs at
151141d7bb44· 78-90 - compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 553-561 - compiler/crates/topaz_self_frontend/topaz/checker/expression_control.tpz at
1cbf38d3d422· 296-305 - compiler/crates/topaz_self_frontend/topaz/checker/patterns.tpz at
1cbf38d3d422· 380-503
Historical compiler facts for the reserved code. These facts describe the former diagnostic, not a 6.0.0 trigger.
Compiler phase: runtime.
Compiler explanation: A runtime match expression reached no matching arm.
Message templates are Pending. The explanation above is not an observed CLI message.
TPZ4006 is retired in Topaz 6.0.0. Its former meaning was a runtime match with no matching arm. The code must not be emitted or assigned a new meaning.
Reserved runtime code and current checking diagnostic
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.
Why
Checking every match removes a separate runtime failure for missing cases. A reserved code keeps historical diagnostics and links understandable.
Source evidence
- compiler/crates/topaz_product_runtime/src/runtime/flow.rs at
151141d7bb44· 355-390 - compiler/crates/topaz_product_runtime/src/runtime/flow.rs at
151141d7bb44· 460-476 - compiler/crates/topaz_product_runtime/src/diagnostic.rs at
151141d7bb44· 78-90 - compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 553-561 - compiler/crates/topaz_self_frontend/topaz/checker/expression_control.tpz at
1cbf38d3d422· 296-305 - compiler/crates/topaz_self_frontend/topaz/checker/patterns.tpz at
1cbf38d3d422· 380-503 - issues/31 at
1cbf38d3d422
Response
LinkMake the match exhaustive. Open input types need a final unguarded wildcard or name pattern.
Reproduction and verification
LinkRejected program
Linkfunction classify(value: int) -> int {match (value) {case 1 => 1}}let result = classify(9)
No stdout.
Expected result
Adding a final unconditional arm repairs the match.
Source evidence
- compiler/crates/topaz_product_runtime/src/runtime/flow.rs at
151141d7bb44· 355-390 - compiler/crates/topaz_product_runtime/src/runtime/flow.rs at
151141d7bb44· 460-476 - compiler/crates/topaz_product_runtime/src/diagnostic.rs at
151141d7bb44· 78-90 - compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 553-561 - compiler/crates/topaz_self_frontend/topaz/checker/expression_control.tpz at
1cbf38d3d422· 296-305 - compiler/crates/topaz_self_frontend/topaz/checker/patterns.tpz at
1cbf38d3d422· 380-503 - issues/31 at
1cbf38d3d422
Repaired program
Linkfunction classify(value: int) -> int {match (value) {case 1 => 1case _ => 0}}let result = classify(9)
Expected result
Expected result
Checking accepts the program. Exit code 0.
Adding a final unconditional arm repairs the match.
Source evidence
- compiler/crates/topaz_product_runtime/src/runtime/flow.rs at
151141d7bb44· 355-390 - compiler/crates/topaz_product_runtime/src/runtime/flow.rs at
151141d7bb44· 460-476 - compiler/crates/topaz_product_runtime/src/diagnostic.rs at
151141d7bb44· 78-90 - compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 553-561 - compiler/crates/topaz_self_frontend/topaz/checker/expression_control.tpz at
1cbf38d3d422· 296-305 - compiler/crates/topaz_self_frontend/topaz/checker/patterns.tpz at
1cbf38d3d422· 380-503 - issues/31 at
1cbf38d3d422