Skip to content

Fix match exhaustiveness for Bool value patterns in tuples (#5226)#166

Merged
IgorDeepakM merged 1 commit intomasterfrom
old_pony_5226
Apr 30, 2026
Merged

Fix match exhaustiveness for Bool value patterns in tuples (#5226)#166
IgorDeepakM merged 1 commit intomasterfrom
old_pony_5226

Conversation

@IgorDeepakM
Copy link
Copy Markdown
Owner

The exhaustiveness checker's existing Bool special-case (tracking seen_true/seen_false) only worked at the top level. Bool literals inside tuples were rejected as non-exhaustive even when both true and false were covered.

Introduce internal-only TK_BOOL_TRUE / TK_BOOL_FALSE singleton type tokens that exist only during the is_match_exhaustive check. Both the discriminee type and case types are expanded so that Bool becomes (TK_BOOL_TRUE | TK_BOOL_FALSE), letting the existing tuple-of-union distribution machinery handle exhaustiveness at any nesting depth.

Closes #5194

The exhaustiveness checker's existing Bool special-case (tracking
seen_true/seen_false) only worked at the top level. Bool literals
inside tuples were rejected as non-exhaustive even when both true and
false were covered.

Introduce internal-only TK_BOOL_TRUE / TK_BOOL_FALSE singleton type
tokens that exist only during the is_match_exhaustive check. Both the
discriminee type and case types are expanded so that Bool becomes
(TK_BOOL_TRUE | TK_BOOL_FALSE), letting the existing tuple-of-union
distribution machinery handle exhaustiveness at any nesting depth.

Closes #5194
@IgorDeepakM IgorDeepakM merged commit 8932c15 into master Apr 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants