js-on-sx: js-new-call accepts list-typed constructor returns
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m1s

new Array(1,2,3) was returning an empty wrapper object because
js-new-call only honoured a non-undefined return when
(type-of ret) === "dict"; SX lists (representing JS arrays) were
silently discarded. Widened the check to accept "list" too.
Fixes new Array(1,2,3).length, String(new Array(1,2,3)), and any
constructor whose body returns a list. built-ins/String:
67/99 → 69/99 (canonical). conformance.sh: 148/148.
This commit is contained in:
2026-05-07 14:24:52 +00:00
parent c81e3f3705
commit 4e554113a9
4 changed files with 20 additions and 16 deletions

View File

@@ -624,7 +624,9 @@
(let
((ret (js-call-with-this obj ctor args)))
(if
(and (not (js-undefined? ret)) (= (type-of ret) "dict"))
(and
(not (js-undefined? ret))
(or (= (type-of ret) "dict") (= (type-of ret) "list")))
ret
obj))))))