js-on-sx: js-loose-eq unwraps Number and Boolean wrappers
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s
js-loose-eq only had a __js_string_value__ unwrap clause, so Object(1.1) == 1.1 returned false. Added parallel clauses for __js_number_value__ and __js_boolean_value__ in both directions. Now new Number(5) == 5, Object(true) == true, etc. built-ins/Object: 26/50 → 37/50. conformance.sh: 148/148.
This commit is contained in:
@@ -1551,6 +1551,14 @@
|
||||
(js-loose-eq (get a "__js_string_value__") b))
|
||||
((and (dict? b) (contains? (keys b) "__js_string_value__"))
|
||||
(js-loose-eq a (get b "__js_string_value__")))
|
||||
((and (dict? a) (contains? (keys a) "__js_number_value__"))
|
||||
(js-loose-eq (get a "__js_number_value__") b))
|
||||
((and (dict? b) (contains? (keys b) "__js_number_value__"))
|
||||
(js-loose-eq a (get b "__js_number_value__")))
|
||||
((and (dict? a) (contains? (keys a) "__js_boolean_value__"))
|
||||
(js-loose-eq (get a "__js_boolean_value__") b))
|
||||
((and (dict? b) (contains? (keys b) "__js_boolean_value__"))
|
||||
(js-loose-eq a (get b "__js_boolean_value__")))
|
||||
(else false))))
|
||||
|
||||
(define js-loose-neq (fn (a b) (not (js-loose-eq a b))))
|
||||
|
||||
Reference in New Issue
Block a user