Skip to content

Commit 11b2c2d

Browse files
committed
Fix leftover assert false in code for null != undefined
Fixes #7225
1 parent ffc0225 commit 11b2c2d

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#### :bug: Bug fix
1616

1717
- Editor: Fix issue where pipe completions would not trigger with generic type arguments. https://github.com/rescript-lang/rescript/pull/7231
18+
- Fix leftover assert false in code for `null != undefined`. https://github.com/rescript-lang/rescript/pull/7232
1819

1920
# 12.0.0-alpha.7
2021

compiler/core/js_exp_make.ml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1752,9 +1752,7 @@ let neq_null_undefined_boolean ?comment (a : t) (b : t) =
17521752
true_
17531753
| Null, Null | Undefined _, Undefined _ -> false_
17541754
| Null, Undefined _ | Undefined _, Null -> true_
1755-
| _ ->
1756-
let _ = assert false in
1757-
{expression_desc = Bin (NotEqEq, a, b); comment}
1755+
| _ -> {expression_desc = Bin (NotEqEq, a, b); comment}
17581756

17591757
let make_exception (s : string) =
17601758
pure_runtime_call Primitive_modules.exceptions Literals.create [str s]

tests/tests/src/test_zero_nullable.mjs

+11
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,23 @@ eq("File \"test_zero_nullable.res\", line 255, characters 5-12", f1$1(undefined)
295295

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

298+
let a = null;
299+
300+
let res = a !== undefined;
301+
302+
let Null_undefined_neq = {
303+
a: a,
304+
b: undefined,
305+
res: res
306+
};
307+
298308
export {
299309
suites,
300310
test_id,
301311
eq,
302312
Test_null,
303313
Test_def,
304314
Test_null_def,
315+
Null_undefined_neq,
305316
}
306317
/* u Not a pure module */

tests/tests/src/test_zero_nullable.res

+6
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,9 @@ let () = {
256256
}
257257

258258
let () = Mt.from_pair_suites(__MODULE__, suites.contents)
259+
260+
module Null_undefined_neq = {
261+
let a = null
262+
let b = undefined
263+
let res = a != b
264+
}

0 commit comments

Comments
 (0)