js-on-sx: js-loose-eq honours NaN inequality across numeric/string paths
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s

This commit is contained in:
2026-05-09 07:33:03 +00:00
parent dcde14a471
commit 5632830118
2 changed files with 10 additions and 2 deletions

View File

@@ -2134,9 +2134,15 @@
((and (= a nil) (js-undefined? b)) true)
((and (js-undefined? a) (= b nil)) true)
((and (js-numeric-type? a) (= (type-of b) "string"))
(= (js-numeric-norm a) (js-to-number b)))
(let ((an (js-numeric-norm a)) (bn (js-to-number b)))
(cond
((or (js-number-is-nan an) (js-number-is-nan bn)) false)
(else (= an bn)))))
((and (= (type-of a) "string") (js-numeric-type? b))
(= (js-to-number a) (js-numeric-norm b)))
(let ((an (js-to-number a)) (bn (js-numeric-norm b)))
(cond
((or (js-number-is-nan an) (js-number-is-nan bn)) false)
(else (= an bn)))))
((= (type-of a) "boolean") (js-loose-eq (js-to-number a) b))
((= (type-of b) "boolean") (js-loose-eq a (js-to-number b)))
((and (dict? a) (contains? (keys a) "__js_string_value__"))