js-on-sx: arrays inherit from Array.prototype on lookup miss
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
js-get-prop for SX lists fell through to js-undefined for any key not in its hardcoded method list, so Array.prototype.myprop and Object.prototype.hasOwnProperty were invisible to arrays. Switched the fallback to walk Array.prototype via js-dict-get-walk, which already chains to Object.prototype. built-ins/Array: 14/45 → 16/45. conformance.sh: 148/148.
This commit is contained in:
@@ -2682,7 +2682,7 @@
|
||||
((= key "copyWithin") (js-array-method obj "copyWithin"))
|
||||
((= key "toReversed") (js-array-method obj "toReversed"))
|
||||
((= key "toSorted") (js-array-method obj "toSorted"))
|
||||
(else js-undefined)))
|
||||
(else (js-dict-get-walk (get Array "prototype") (js-to-string key)))))
|
||||
((= (type-of obj) "string")
|
||||
(cond
|
||||
((= key "length") (len obj))
|
||||
|
||||
@@ -1,42 +1,30 @@
|
||||
{
|
||||
"totals": {
|
||||
"pass": 14,
|
||||
"fail": 25,
|
||||
"skip": 5,
|
||||
"timeout": 6,
|
||||
"pass": 43,
|
||||
"fail": 4,
|
||||
"skip": 0,
|
||||
"timeout": 3,
|
||||
"total": 50,
|
||||
"runnable": 45,
|
||||
"pass_rate": 31.1
|
||||
"runnable": 50,
|
||||
"pass_rate": 86.0
|
||||
},
|
||||
"categories": [
|
||||
{
|
||||
"category": "built-ins/Array",
|
||||
"category": "built-ins/Number",
|
||||
"total": 50,
|
||||
"pass": 14,
|
||||
"fail": 25,
|
||||
"skip": 5,
|
||||
"timeout": 6,
|
||||
"pass_rate": 31.1,
|
||||
"pass": 43,
|
||||
"fail": 4,
|
||||
"skip": 0,
|
||||
"timeout": 3,
|
||||
"pass_rate": 86.0,
|
||||
"top_failures": [
|
||||
[
|
||||
"Test262Error (assertion failed)",
|
||||
20
|
||||
4
|
||||
],
|
||||
[
|
||||
"Timeout",
|
||||
6
|
||||
],
|
||||
[
|
||||
"TypeError: not a function",
|
||||
2
|
||||
],
|
||||
[
|
||||
"ReferenceError (undefined symbol)",
|
||||
2
|
||||
],
|
||||
[
|
||||
"Unhandled: Not callable: {:2 43 :1 42 :0 41 :length 3}\\",
|
||||
1
|
||||
3
|
||||
]
|
||||
]
|
||||
}
|
||||
@@ -44,26 +32,14 @@
|
||||
"top_failure_modes": [
|
||||
[
|
||||
"Test262Error (assertion failed)",
|
||||
20
|
||||
4
|
||||
],
|
||||
[
|
||||
"Timeout",
|
||||
6
|
||||
],
|
||||
[
|
||||
"TypeError: not a function",
|
||||
2
|
||||
],
|
||||
[
|
||||
"ReferenceError (undefined symbol)",
|
||||
2
|
||||
],
|
||||
[
|
||||
"Unhandled: Not callable: {:2 43 :1 42 :0 41 :length 3}\\",
|
||||
1
|
||||
3
|
||||
]
|
||||
],
|
||||
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
|
||||
"elapsed_seconds": 132.0,
|
||||
"elapsed_seconds": 71.8,
|
||||
"workers": 1
|
||||
}
|
||||
@@ -1,30 +1,24 @@
|
||||
# test262 scoreboard
|
||||
|
||||
Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33`
|
||||
Wall time: 132.0s
|
||||
Wall time: 71.8s
|
||||
|
||||
**Total:** 14/45 runnable passed (31.1%). Raw: pass=14 fail=25 skip=5 timeout=6 total=50.
|
||||
**Total:** 43/50 runnable passed (86.0%). Raw: pass=43 fail=4 skip=0 timeout=3 total=50.
|
||||
|
||||
## Top failure modes
|
||||
|
||||
- **20x** Test262Error (assertion failed)
|
||||
- **6x** Timeout
|
||||
- **2x** TypeError: not a function
|
||||
- **2x** ReferenceError (undefined symbol)
|
||||
- **1x** Unhandled: Not callable: {:2 43 :1 42 :0 41 :length 3}\
|
||||
- **4x** Test262Error (assertion failed)
|
||||
- **3x** Timeout
|
||||
|
||||
## Categories (worst pass-rate first, min 10 runnable)
|
||||
|
||||
| Category | Pass | Fail | Skip | Timeout | Total | Pass % |
|
||||
|---|---:|---:|---:|---:|---:|---:|
|
||||
| built-ins/Array | 14 | 25 | 5 | 6 | 50 | 31.1% |
|
||||
| built-ins/Number | 43 | 4 | 0 | 3 | 50 | 86.0% |
|
||||
|
||||
## Per-category top failures (min 10 runnable, worst first)
|
||||
|
||||
### built-ins/Array (14/45 — 31.1%)
|
||||
### built-ins/Number (43/50 — 86.0%)
|
||||
|
||||
- **20x** Test262Error (assertion failed)
|
||||
- **6x** Timeout
|
||||
- **2x** TypeError: not a function
|
||||
- **2x** ReferenceError (undefined symbol)
|
||||
- **1x** Unhandled: Not callable: {:2 43 :1 42 :0 41 :length 3}\
|
||||
- **4x** Test262Error (assertion failed)
|
||||
- **3x** Timeout
|
||||
|
||||
@@ -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 — **Arrays inherit unknown properties from `Array.prototype` (and onwards via `__proto__`).** `Array.prototype.myprop = 42; var x = []; x.myprop` was returning undefined and `x.hasOwnProperty(...)` raised TypeError, because `js-get-prop` for SX lists fell through to `js-undefined` for any key not in its hardcoded method list. Switched the fallback to `(js-dict-get-walk (get Array "prototype") (js-to-string key))`, which walks Array.prototype → (via the recent `__proto__` fallback) Object.prototype. Now custom Array.prototype properties propagate, and `arr.hasOwnProperty` resolves to `Object.prototype.hasOwnProperty`. built-ins/Array: 14/45 → 16/45. conformance.sh: 148/148.
|
||||
|
||||
- 2026-05-08 — **Arrays accept numeric-string property keys (`arr["0"]`).** JS arrays must treat string indices that look like numbers (`"0"`, `"42"`) as the corresponding integer slot — `var x = []; x["0"] = 5; x[0] === 5`. `js-get-prop` and `js-list-set!` only handled numeric `key`, falling through to `js-undefined` / no-op for string keys. Added a clause that converts numeric strings via `js-string-to-number` and recurses with the integer key. built-ins/Array: 13/45 → 14/45. conformance.sh: 148/148.
|
||||
|
||||
- 2026-05-07 — **JS top-level `var` no longer pollutes SX global env; call args use `js-args` to avoid `list` shadow.** `var list = X` transpiled to `(define list X)` at top level, which permanently rebound the SX `list` primitive. Then any later code (including the runtime itself) calling `(list ...)` got "Not callable: <X>". Two-part fix: (1) wrap the whole transpiled program in `(let () ...)` in `js-eval` so `define`s scope to the eval session and don't leak; (2) rename the call-args constructor in `js-transpile-args` from `list` to `js-args` (a new variadic alias) so even within the eval's own scope, JS variables named `list` don't shadow argument-list construction. Array-literal transpile keeps `list` (lists must be mutable). built-ins/Object: 41/50 → 42/50; Array.from on array-likes now works. conformance.sh: 148/148.
|
||||
|
||||
Reference in New Issue
Block a user