Files
rose-ash/hosts/ocaml/lib
giles 4db1f85fe8
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s
Fix dict equality: structural eq for plain dicts, Integer/Number in equal?
Two related kernel bugs were causing the HS conformance test
"arrays containing objects work" to fail with the misleading message
"Expected ({:a 1} {:b 2}) but got ({:a 1} {:b 2})".

1. sx_primitives.ml safe_eq: Dict/Dict only returned true for DOM-wrapped
   dicts (those carrying __host_handle); all other dict pairs returned
   false unconditionally. Plain dict literals can never have been =
   to each other. Add the structural-equality fallback: when neither
   side has a host handle, compare lengths and walk keys.

2. sx_browser.ml deep_equal (the kernel binding for equal?): had a
   Number/Number branch but no Integer/Integer or cross-Integer/Number
   branches, so since the numeric tower change Integer 1 vs Integer 1
   was falling through to the catch-all and returning false. Mirror the
   cases from run_tests.ml deep_equal which already had them.

Verified via direct kernel probe:
  (= {:a 1} {:a 1})                        => true   (was false)
  (= {:a 1 :b 2} {:b 2 :a 1})              => true   (was false)
  (equal? 1 1)                             => true   (was false)
  (equal? {:a 1} {:a 1})                   => true   (was false)
  (equal? (list {:a 1}) (list {:a 1}))     => true   (was false)

HS suite arrayLiteral: 7/8 → 8/8.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 21:20:43 +00:00
..