S("a") with @as("a") A | S(string), and treat @as(true) Yes | Ans(bool) as fully covered by Yes | Ans(false).Semantic Diff
2 commits, rendered from their records.
| Range | Commits | Changelog | Areas | JS output changes | Formats | Failed checks |
|---|---|---|---|---|---|---|
f52f1d1988f666515ad0debb7b7c0150ece798c9..pr-8914 | 2 | ๐ Bug fix | typecheckertests | 0 | none | 2 |
S("a") with @as("a") A | S(string), and treat @as(true) Yes | Ans(bool) as fully covered by Yes | Ans(false).f52f1d1988f666515ad0debb7b7c0150ece798c9..pr-8914A payload pattern whose values are all literal-case values can never match (warning 11/12), and a literal case covers the equal bool payload value in the exhaustiveness check. Fixes #8806.
S("a") with @as("a") A | S(string), and treat @as(true) Yes | Ans(bool) as fully covered by Yes | Ans(false).| A | changes/untagged-literal-overlap-warnings.fix.md | +1 | โ0 |
| M | compiler/ext/warnings.ml | +8 | โ6 |
| M | compiler/ext/warnings.mli | +2 | โ2 |
| M | compiler/ml/lambda.ml | +5 | โ24 |
| M | compiler/ml/parmatch.ml | +233 | โ5 |
| M | compiler/ml/variant_runtime.ml | +24 | โ7 |
| M | compiler/ml/variant_runtime.mli | +8 | โ0 |
| A | tests/build_tests/super_errors/expected/warning_11_untagged_bool_payload_overlap.res.expected | +12 | โ0 |
| A | tests/build_tests/super_errors/expected/warning_11_untagged_literal_shadows_payload.res.expected | +65 | โ0 |
| A | tests/build_tests/super_errors/expected/warning_11_untagged_literal_shadows_payload_kinds.res.expected | +38 | โ0 |
| A | tests/build_tests/super_errors/expected/warning_12_untagged_literal_shadows_or_pattern.res.expected | +12 | โ0 |
| A | tests/build_tests/super_errors/fixtures/warning_11_untagged_bool_payload_overlap.res | +16 | โ0 |
| A | tests/build_tests/super_errors/fixtures/warning_11_untagged_literal_shadows_payload.res | +44 | โ0 |
| A | tests/build_tests/super_errors/fixtures/warning_11_untagged_literal_shadows_payload_kinds.res | +26 | โ0 |
| A | tests/build_tests/super_errors/fixtures/warning_12_untagged_literal_shadows_or_pattern.res | +8 | โ0 |
| M | tests/tests/src/unboxed_variant_fold_test.mjs | +74 | โ63 |
| M | tests/tests/src/unboxed_variant_fold_test.res | +11 | โ1 |
The check for untagged payload patterns shadowed by literal cases ran only when warning 11 was active, so with -w -11+12 or @warning("-11") a dead or-pattern alternative got no warning 12. It now runs when either warning is active; the usefulness analysis is still gated on warning 11.
@unboxed type t = | @as("a") A | S(string)@warning("-11")let g = x => switch x { | S("a") => 1 | S("a" | "c") => 2 | S(_) | A => 3 }
Before: no warnings
After: Warning 12 on the "a" in S("a" | "c"); the dead S("a") case stays
silent because warning 11 is off.
tests/build_tests/~ super_errors/fixtures/warning_12_untagged_literal_shadows_or_pattern.res| M | compiler/ml/parmatch.ml | +5 | โ2 |
| M | tests/build_tests/super_errors/expected/warning_12_untagged_literal_shadows_or_pattern.res.expected | +13 | โ0 |
| M | tests/build_tests/super_errors/fixtures/warning_12_untagged_literal_shadows_or_pattern.res | +10 | โ0 |