js-on-sx: native prototypes inherit from Object.prototype
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
Per ES, every native prototype's [[Prototype]] is Object.prototype (and Function.prototype.[[Prototype]] is too). Was missing those links, so Object.prototype.isPrototypeOf(Boolean.prototype) returned false (the explicit isPrototypeOf walks __proto__, not the recent fallback). Added 5 dict-set! lines to the post-init. built-ins/Boolean: 22/27 → 23/27, built-ins/Number: 44/50 → 45/50. conformance.sh: 148/148.
This commit is contained in:
@@ -4646,6 +4646,11 @@
|
||||
(dict-set! Array "__proto__" (get js-function-global "prototype"))
|
||||
(dict-set! Number "__proto__" (get js-function-global "prototype"))
|
||||
(dict-set! String "__proto__" (get js-function-global "prototype"))
|
||||
(dict-set! Boolean "__proto__" (get js-function-global "prototype")))
|
||||
(dict-set! Boolean "__proto__" (get js-function-global "prototype"))
|
||||
(dict-set! (get Array "prototype") "__proto__" (get Object "prototype"))
|
||||
(dict-set! (get Number "prototype") "__proto__" (get Object "prototype"))
|
||||
(dict-set! (get String "prototype") "__proto__" (get Object "prototype"))
|
||||
(dict-set! (get Boolean "prototype") "__proto__" (get Object "prototype"))
|
||||
(dict-set! (get js-function-global "prototype") "__proto__" (get Object "prototype")))
|
||||
|
||||
(define js-global {:undefined js-undefined :JSON JSON :parseInt parseInt :Object Object :isNaN js-global-is-nan :Infinity inf :NaN 0 :String String :Boolean Boolean :Array Array :Math Math :parseFloat parseFloat :Number Number :console console :isFinite js-global-is-finite})
|
||||
|
||||
@@ -40,6 +40,6 @@
|
||||
]
|
||||
],
|
||||
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
|
||||
"elapsed_seconds": 32.3,
|
||||
"elapsed_seconds": 38.2,
|
||||
"workers": 1
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
# test262 scoreboard
|
||||
|
||||
Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33`
|
||||
Wall time: 32.3s
|
||||
Wall time: 38.2s
|
||||
|
||||
**Total:** 44/50 runnable passed (88.0%). Raw: pass=44 fail=6 skip=0 timeout=0 total=50.
|
||||
|
||||
|
||||
@@ -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-08 — **`Array.prototype` / `Number.prototype` / etc. inherit from `Object.prototype`.** Per ES, every native prototype's `[[Prototype]]` is `Object.prototype` (and `Function.prototype.[[Prototype]]` is also `Object.prototype`). Was missing those `__proto__` links, so `Object.prototype.isPrototypeOf(Boolean.prototype)` returned false (the explicit isPrototypeOf walks `__proto__`, not the recent fallback). Added 5 `dict-set!` lines to the post-init block at the end of `runtime.sx`. built-ins/Boolean: 22/27 → 23/27, built-ins/Number: 44/50 → 45/50. conformance.sh: 148/148.
|
||||
|
||||
- 2026-05-08 — **`delete obj.key` actually removes the key.** `js-delete-prop` was setting the value to `js-undefined` instead of removing the key, so subsequent `'key' in obj` returned true and proto-chain lookup didn't fall through to the parent. Switched to `dict-delete!` (existing SX primitive). Now `delete Boolean.prototype.toString; Boolean.prototype.toString()` correctly walks up to `Object.prototype.toString` and returns `"[object Boolean]"`. built-ins/Boolean: 21/27 → 22/27. conformance.sh: 148/148.
|
||||
|
||||
- 2026-05-08 — **`Boolean(NaN) === false` (and `!NaN === true`).** `js-to-boolean` was returning `true` for NaN because NaN ≠ 0 by IEEE semantics, so the `(= v 0)` test fell through to the truthy-else clause. Per ES, NaN is one of the falsy values. Added a `(js-number-is-nan v)` clause. built-ins/Boolean: 19/27 → 21/27. conformance.sh: 148/148.
|
||||
|
||||
Reference in New Issue
Block a user