diff --git a/lib/js/runtime.sx b/lib/js/runtime.sx index ad2c183f..76eb9df7 100644 --- a/lib/js/runtime.sx +++ b/lib/js/runtime.sx @@ -3404,7 +3404,7 @@ (and (>= idx 0) (< idx (len o)) (integer? idx)))) (else false)))) -(define Object {:keys js-object-keys :getPrototypeOf js-object-get-prototype-of :isSealed js-object-is-sealed :seal js-object-seal :create js-object-create :isExtensible js-object-is-extensible :is js-object-is :setPrototypeOf js-object-set-prototype-of :getOwnPropertyNames js-object-get-own-property-names :getOwnPropertyDescriptors js-object-get-own-property-descriptors :defineProperty js-object-define-property :fromEntries js-object-from-entries :getOwnPropertyDescriptor js-object-get-own-property-descriptor :assign js-object-assign :isFrozen js-object-is-frozen :freeze js-object-freeze :values js-object-values :hasOwn js-object-has-own :prototype {:hasOwnProperty (fn (k) (let ((o (js-this))) (js-object-has-own o k))) :toLocaleString (fn () "[object Object]") :isPrototypeOf (fn (o) (let ((this-val (js-this))) (cond ((not (dict? o)) false) (else (let ((proto (if (contains? (keys o) "__proto__") (get o "__proto__") nil))) (cond ((= proto this-val) true) ((= proto nil) false) (else ((get (get Object "prototype") "isPrototypeOf") proto)))))))) :toString (fn () "[object Object]") :propertyIsEnumerable (fn (k) (let ((o (js-this))) (js-object-has-own o k))) :valueOf (fn () (js-this))} :__callable__ (fn (&rest args) (cond ((= (len args) 0) (dict)) ((or (= (nth args 0) nil) (js-undefined? (nth args 0))) (dict)) ((= (type-of (nth args 0)) "string") (js-new-call String (list (nth args 0)))) ((= (js-typeof (nth args 0)) "number") (js-new-call Number (list (nth args 0)))) ((= (js-typeof (nth args 0)) "boolean") (js-new-call Boolean (list (nth args 0)))) (else (nth args 0)))) :preventExtensions js-object-prevent-extensions :entries js-object-entries :defineProperties js-object-define-properties}) +(define Object {:keys js-object-keys :getPrototypeOf js-object-get-prototype-of :isSealed js-object-is-sealed :seal js-object-seal :create js-object-create :isExtensible js-object-is-extensible :is js-object-is :setPrototypeOf js-object-set-prototype-of :getOwnPropertyNames js-object-get-own-property-names :getOwnPropertyDescriptors js-object-get-own-property-descriptors :defineProperty js-object-define-property :fromEntries js-object-from-entries :getOwnPropertyDescriptor js-object-get-own-property-descriptor :assign js-object-assign :isFrozen js-object-is-frozen :freeze js-object-freeze :values js-object-values :hasOwn js-object-has-own :prototype {:hasOwnProperty (fn (k) (let ((o (js-this))) (js-object-has-own o k))) :toLocaleString (fn () "[object Object]") :isPrototypeOf (fn (o) (let ((this-val (js-this))) (cond ((not (dict? o)) false) (else (let ((proto (if (contains? (keys o) "__proto__") (get o "__proto__") nil))) (cond ((= proto this-val) true) ((= proto nil) false) (else ((get (get Object "prototype") "isPrototypeOf") proto)))))))) :toString (fn () "[object Object]") :propertyIsEnumerable (fn (k) (let ((o (js-this))) (js-object-has-own o k))) :valueOf (fn () (js-this))} :__callable__ (fn (&rest args) (let ((this-val (js-this))) (let ((is-new (and (dict? this-val) (contains? (keys this-val) "__proto__") (= (get this-val "__proto__") (get Object "prototype"))))) (cond ((= (len args) 0) (if is-new this-val (dict))) ((or (= (nth args 0) nil) (js-undefined? (nth args 0))) (if is-new this-val (dict))) ((= (type-of (nth args 0)) "string") (js-new-call String (list (nth args 0)))) ((= (js-typeof (nth args 0)) "number") (js-new-call Number (list (nth args 0)))) ((= (js-typeof (nth args 0)) "boolean") (js-new-call Boolean (list (nth args 0)))) (else (nth args 0)))))) :preventExtensions js-object-prevent-extensions :entries js-object-entries :defineProperties js-object-define-properties}) (dict-set! Object "length" 1) diff --git a/lib/js/test262-scoreboard.json b/lib/js/test262-scoreboard.json index b245ec0d..9eda0c0f 100644 --- a/lib/js/test262-scoreboard.json +++ b/lib/js/test262-scoreboard.json @@ -1,61 +1,61 @@ { "totals": { - "pass": 78, - "fail": 15, - "skip": 1, - "timeout": 6, - "total": 100, - "runnable": 99, - "pass_rate": 78.8 + "pass": 41, + "fail": 9, + "skip": 0, + "timeout": 0, + "total": 50, + "runnable": 50, + "pass_rate": 82.0 }, "categories": [ { - "category": "built-ins/String", - "total": 100, - "pass": 78, - "fail": 15, - "skip": 1, - "timeout": 6, - "pass_rate": 78.8, + "category": "built-ins/Object", + "total": 50, + "pass": 41, + "fail": 9, + "skip": 0, + "timeout": 0, + "pass_rate": 82.0, "top_failures": [ - [ - "Test262Error (assertion failed)", - 13 - ], - [ - "Timeout", - 6 - ], [ "ReferenceError (undefined symbol)", - 1 + 4 ], [ "SyntaxError (parse/unsupported syntax)", + 2 + ], + [ + "Test262Error (assertion failed)", + 2 + ], + [ + "runner-error: sx_server closed stdout mid-epoch", 1 ] ] } ], "top_failure_modes": [ - [ - "Test262Error (assertion failed)", - 13 - ], - [ - "Timeout", - 6 - ], [ "ReferenceError (undefined symbol)", - 1 + 4 ], [ "SyntaxError (parse/unsupported syntax)", + 2 + ], + [ + "Test262Error (assertion failed)", + 2 + ], + [ + "runner-error: sx_server closed stdout mid-epoch", 1 ] ], "pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33", - "elapsed_seconds": 226.1, + "elapsed_seconds": 37.1, "workers": 1 } \ No newline at end of file diff --git a/lib/js/test262-scoreboard.md b/lib/js/test262-scoreboard.md index dca36c35..2ad95af5 100644 --- a/lib/js/test262-scoreboard.md +++ b/lib/js/test262-scoreboard.md @@ -1,28 +1,28 @@ # test262 scoreboard Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33` -Wall time: 226.1s +Wall time: 37.1s -**Total:** 78/99 runnable passed (78.8%). Raw: pass=78 fail=15 skip=1 timeout=6 total=100. +**Total:** 41/50 runnable passed (82.0%). Raw: pass=41 fail=9 skip=0 timeout=0 total=50. ## Top failure modes -- **13x** Test262Error (assertion failed) -- **6x** Timeout -- **1x** ReferenceError (undefined symbol) -- **1x** SyntaxError (parse/unsupported syntax) +- **4x** ReferenceError (undefined symbol) +- **2x** SyntaxError (parse/unsupported syntax) +- **2x** Test262Error (assertion failed) +- **1x** runner-error: sx_server closed stdout mid-epoch ## Categories (worst pass-rate first, min 10 runnable) | Category | Pass | Fail | Skip | Timeout | Total | Pass % | |---|---:|---:|---:|---:|---:|---:| -| built-ins/String | 78 | 15 | 1 | 6 | 100 | 78.8% | +| built-ins/Object | 41 | 9 | 0 | 0 | 50 | 82.0% | ## Per-category top failures (min 10 runnable, worst first) -### built-ins/String (78/99 — 78.8%) +### built-ins/Object (41/50 — 82.0%) -- **13x** Test262Error (assertion failed) -- **6x** Timeout -- **1x** ReferenceError (undefined symbol) -- **1x** SyntaxError (parse/unsupported syntax) +- **4x** ReferenceError (undefined symbol) +- **2x** SyntaxError (parse/unsupported syntax) +- **2x** Test262Error (assertion failed) +- **1x** runner-error: sx_server closed stdout mid-epoch diff --git a/plans/js-on-sx.md b/plans/js-on-sx.md index a59a3d2c..31649d1e 100644 --- a/plans/js-on-sx.md +++ b/plans/js-on-sx.md @@ -158,6 +158,8 @@ Each item: implement → tests → update progress. Mark `[x]` when tests green. Append-only record of completed iterations. Loop writes one line per iteration: date, what was done, test count delta. +- 2026-05-07 — **`Object.__callable__` returns `this` for `new Object()` no-args path.** `js-new-call Object` had `obj.__proto__ = Object.prototype` already set, but then Object.__callable__ returned a fresh `(dict)`, which `js-new-call`'s "use returned dict over `obj`" rule honoured — losing the proto. Added a `is-new` check (`this.__proto__ === Object.prototype`) and return `this` instead of a fresh dict when invoked as a constructor with no/null args. Now `new Object().__proto__ === Object.prototype`, `Object.prototype.isPrototypeOf(new Object())`, and `.constructor === Object` all work. built-ins/Object: 37/50 → 41/50. conformance.sh: 148/148. + - 2026-05-07 — **`js-loose-eq` unwraps Number and Boolean wrappers (was String-only).** `Object(1.1) == 1.1` was returning `false`: loose-eq only had a clause for `__js_string_value__`. Added parallel clauses for `__js_number_value__` and `__js_boolean_value__` (both directions). Now `new Number(5) == 5`, `Object(true) == true`, etc. built-ins/Object: 26/50 → 37/50. conformance.sh: 148/148. - 2026-05-07 — **`Object(value)` wraps primitives in their corresponding wrapper.** Per ES spec, `Object('s') instanceof String === true`, `Object(42).constructor === Number`, etc. Was passing primitives through as-is, so `Object('s').constructor` was undefined. Added clauses to `Object.__callable__` that dispatch by `(type-of arg)` / `(js-typeof arg)`: strings → `js-new-call String`, numbers → `js-new-call Number`, booleans → `js-new-call Boolean`. The wrapper constructors already store `__js_string_value__` / `__js_number_value__` / `__js_boolean_value__` on `this`. built-ins/Object: 16/50 → 26/50. conformance.sh: 148/148.