js-on-sx: Number.prototype.toString(radix) avoids rational div-by-zero
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 43s

This commit is contained in:
2026-05-10 02:23:38 +00:00
parent ad897122d7
commit 1a34cc4456
2 changed files with 5 additions and 3 deletions

View File

@@ -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-10 — **`Number.prototype.toString(radix)` no longer crashes on rational division-by-zero.** `js-num-to-str-radix` was probing for ±Infinity by comparing against `(/ 1 0)` / `(/ -1 0)` — but on the rational arithmetic path that throws "rational: division by zero" before the comparison ever happens, so every `Number(x).toString(radix)` call exploded. Replaced the probes with `(js-infinity-value)` / `(- 0 (js-infinity-value))` and the NaN check with `js-number-is-nan`. Result: built-ins/Number/prototype/toString 0/30 → 29/30 (+29). Number 26/30. conformance.sh: 148/148.
- 2026-05-10 — **Array literal elision (holes), `list instanceof Array`, `array.toString` identity.** Three coupled fixes for `language/expressions/array`. (1) Parser: `jp-array-loop` accepts a leading or interior `,` as elision and pushes `(js-undef)`, so `[,]`, `[,,3,,,]`, `[1,,3]` parse and produce length 1, 5, 3. (2) Runtime: `js-instanceof` adds a `(list? obj)` arm that returns true when the right-hand side is `Array` (or `Object`). (3) Runtime: `js-get-prop` for `key="toString"` on a list returns the actual `Array.prototype.toString` slot via `js-dict-get-walk` instead of a fresh `js-array-method` callable, so `[1,2,3].toString === Array.prototype.toString`. `toLocaleString` left on the legacy arm — its proto entry is a dict-with-`__callable__` whose body re-enters `js-invoke-method`, which would loop. Result: language/expressions/array 13/30 → 21/30 (+8). conformance.sh: 148/148.
- 2026-05-10 — **`Object.getOwnPropertyDescriptor` skips internal `__proto__` and `__js_order__` keys.** Was returning a regular property descriptor for our internal `__proto__` and `__js_order__` markers — `Object.getOwnPropertyDescriptor({__proto__: null}, "__proto__")` returned `{configurable, enumerable, value: null, writable}` instead of `undefined` per spec. Added a `(js-key-internal? sk)` short-circuit in the descriptor path that returns `:js-undefined` for internal keys. Result: language/expressions/object 13/30 → 16/30. Object 30/30 holds, getOwnPropertyDescriptor 28/30. conformance.sh: 148/148.