Skip to content

Fix issue with pattern matching empty list which interferes with bool… #7237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- Editor: Fix issue where pipe completions would not trigger with generic type arguments. https://github.com/rescript-lang/rescript/pull/7231
- Fix leftover assert false in code for `null != undefined`. https://github.com/rescript-lang/rescript/pull/7232
- Editor: Fix issue where completions would not show up inside of object bodies. https://github.com/rescript-lang/rescript/pull/7230
- Fix issue with pattern matching empty list which interferes with boolean optimisations. https://github.com/rescript-lang/rescript/pull/7237

#### :house: Internal

Expand Down
3 changes: 2 additions & 1 deletion compiler/ml/matching.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2245,7 +2245,8 @@ let combine_constructor sw_names loc arg ex_pat cstr partial ctx def
let arg =
if Datarepr.constructor_has_optional_shape cstr then
Lprim (Pis_not_none, [arg], loc)
else arg
else
Lprim (Pjscomp Cneq, [arg; Lconst (Const_base (Const_int 0))], loc)
in
Lifthenelse (arg, act2, act1)
| 2, 0, [(i1, act1); (_, act2)], []
Expand Down
Loading
Loading