diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b51925e8f..5234be8b7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/compiler/core/js_exp_make.ml b/compiler/core/js_exp_make.ml index 652f1d844d..8980667ff2 100644 --- a/compiler/core/js_exp_make.ml +++ b/compiler/core/js_exp_make.ml @@ -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] diff --git a/tests/tests/src/test_zero_nullable.mjs b/tests/tests/src/test_zero_nullable.mjs index ebb251de0f..1cf2904609 100644 --- a/tests/tests/src/test_zero_nullable.mjs +++ b/tests/tests/src/test_zero_nullable.mjs @@ -295,6 +295,16 @@ 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, @@ -302,5 +312,6 @@ export { Test_null, Test_def, Test_null_def, + Null_undefined_neq, } /* u Not a pure module */ diff --git a/tests/tests/src/test_zero_nullable.res b/tests/tests/src/test_zero_nullable.res index fbc3c6ab1d..08d37ec31c 100644 --- a/tests/tests/src/test_zero_nullable.res +++ b/tests/tests/src/test_zero_nullable.res @@ -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 +}