Skip to content

Fix leftover assert false in code for null != undefined #7232

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 6, 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 @@ -15,6 +15,7 @@
#### :bug: Bug fix

- 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

# 12.0.0-alpha.7

Expand Down
4 changes: 1 addition & 3 deletions compiler/core/js_exp_make.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1752,9 +1752,7 @@ let neq_null_undefined_boolean ?comment (a : t) (b : t) =
true_
| Null, Null | Undefined _, Undefined _ -> false_
| Null, Undefined _ | Undefined _, Null -> true_
| _ ->
let _ = assert false in
{expression_desc = Bin (NotEqEq, a, b); comment}
| _ -> {expression_desc = Bin (NotEqEq, a, b); comment}

let make_exception (s : string) =
pure_runtime_call Primitive_modules.exceptions Literals.create [str s]
Expand Down
11 changes: 11 additions & 0 deletions tests/tests/src/test_zero_nullable.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,23 @@ eq("File \"test_zero_nullable.res\", line 255, characters 5-12", f1$1(undefined)

Mt.from_pair_suites("Test_zero_nullable", suites.contents);

let a = null;

let res = a !== undefined;

let Null_undefined_neq = {
a: a,
b: undefined,
res: res
};

export {
suites,
test_id,
eq,
Test_null,
Test_def,
Test_null_def,
Null_undefined_neq,
}
/* u Not a pure module */
6 changes: 6 additions & 0 deletions tests/tests/src/test_zero_nullable.res
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,9 @@ let () = {
}

let () = Mt.from_pair_suites(__MODULE__, suites.contents)

module Null_undefined_neq = {
let a = null
let b = undefined
let res = a != b
}
Loading