feat(ir): collection names declared in std are ordinary types #474

Merged
argus merged 11 commits from loop/468-collection-names into main 2026-10-25 04:46:56 +00:00
Collaborator

Closes #468

What

  • ir/instantiate.trb: the six collection names are runtime primitives only while std/ declares no type of that name; a declared generic type is built like filledList builds it today.
  • ir/elements.trb: isListSetter also recognizes the wrapper shape of the record's ArrayList.set.
  • Buffer.holdsClose: lowered constant per item type (mayHoldClose), K5 list + manifest row (docs/design/NATIVES.md counts: kernel 156, total 537).
  • Tests: lowering tests for a declared ArrayList over Buffer (compiler/tests/lower-collections.test.trb), the manifest row (natives.test.trb), the conformance program tests/conformance/buffer-holds-close.trb.
  • isListSetter is public, and compiler/tests/elements.test.trb pins it on hand-built IR: the runtime's torb_list_set, the old wrapper of a native fn and the set of a declared list (receiver = the items field of self, every other parameter in its own position) are setters; a body with an instruction before the call, a reordered index/value, a witness table, a missing parameter, a receiver that is no direct field of self, or a callee that is another runtime function are not. Hand-built, because a source program can only write the shape the lowering gives it. What this does not assert: a source-level values[i].f = v on the declared list as an element step. elementTypeOf admits only a container of the runtime's list type, so a record-typed container keeps its take-out and put-back until the follow-up commit (which moves std/) teaches it; this commit teaches the setter shape only.
  • Conformance: tests/conformance/declared-list-shape.trb runs Pile, a program-local Iterate/Length/MutableIndex type over a Buffer in the shape of the declared ArrayList (withCapacity, append in written order, for through iterate, a[i], a[i] = v, a[i].field = v, a copy is a value). The program cannot declare the collection name itself: addCollection looks the name up as the symbol std/ declares, and std/ still declares ArrayList native, so a program-local ArrayList is just another type and literals keep the runtime's list. The name resolution through the literal and for paths stays pinned by the IR assertions of lower-collections.test.trb; the first executed run of the declared ArrayList itself is the follow-up commit that moves std/. Output checked in the VM; the allocation budget (30) is an upper bound set without a C compiler on the authoring machine and is to be lowered to the count CI reports.
  • Docs: the Buffer block of docs/standard-library/core.md lists holdsClose. Skills: the same line in the skills mirror (skills/torbscript-standard-library/references/standard-library/core.md), regenerated by hand to match the output of torb docs skill.

Baseline on the primitive

The table below was measured at head fff3d176; nothing in compiler/src, std/ or runtime/ changed behaviour since, so it is the baseline for the follow-up.

collection-cost.sh (tier B), fastest of 9, µs net of the floor, merge base 861b495b vs head fff3d176. Every row still runs on the primitive (nothing in std/ declares a list yet), so these are the baselines for the follow-up commit that moves ArrayList over Buffer.

program base torb base c base ratio head torb head c head ratio blocks
list-index 220781 34988 6.31x 233395 35247 6.62x 22
list-iterate 398628 39100 10.19x 399924 35655 11.21x 22
array-write 169382 26569 6.37x 169543 30232 5.60x 21
buffer-write 167307 24250 6.89x 170183 24330 6.99x 21
list-slice 16038 6619 2.42x 15770 6201 2.54x 21
list-write-shared 80907 22033 3.67x 89422 20942 4.26x 261
list-literal 305911 17116 17.87x 307898 17204 17.89x 8000001

bytes-pass (fastest of 9): Buffer<UInt8> base 0.0421 s, head 0.0382 s; List<UInt8> base 0.0454 s, head 0.0471 s (gate: ratio 0.890, bound 1.10). Allocation counts are the same in base and head.

Test

CI on this branch (forge workflow): bootstrap, tier A (compiler tests, format --check, docs declarations --check, conformance gate), tier B (collection-cost, bytes-pass), commit messages, release-sync/registry, pdisc. Result: see the checks of the head commit.

Seed impact

Yes (two-commit rule, seed refresh stays with the owner).

Closes #468 ## What - `ir/instantiate.trb`: the six collection names are runtime primitives only while `std/` declares no type of that name; a declared generic type is built like `filledList` builds it today. - `ir/elements.trb`: `isListSetter` also recognizes the wrapper shape of the record's `ArrayList.set`. - `Buffer.holdsClose`: lowered constant per item type (`mayHoldClose`), K5 list + manifest row (`docs/design/NATIVES.md` counts: kernel 156, total 537). - Tests: lowering tests for a declared `ArrayList` over `Buffer` (`compiler/tests/lower-collections.test.trb`), the manifest row (`natives.test.trb`), the conformance program `tests/conformance/buffer-holds-close.trb`. - `isListSetter` is public, and `compiler/tests/elements.test.trb` pins it on hand-built IR: the runtime's `torb_list_set`, the old wrapper of a `native fn` and the `set` of a declared list (receiver = the `items` field of `self`, every other parameter in its own position) are setters; a body with an instruction before the call, a reordered index/value, a witness table, a missing parameter, a receiver that is no direct field of `self`, or a callee that is another runtime function are not. Hand-built, because a source program can only write the shape the lowering gives it. What this does not assert: a source-level `values[i].f = v` on the declared list as an element step. `elementTypeOf` admits only a container of the runtime's list type, so a record-typed container keeps its take-out and put-back until the follow-up commit (which moves `std/`) teaches it; this commit teaches the setter shape only. - Conformance: `tests/conformance/declared-list-shape.trb` runs `Pile`, a program-local `Iterate`/`Length`/`MutableIndex` type over a `Buffer` in the shape of the declared `ArrayList` (`withCapacity`, `append` in written order, `for` through `iterate`, `a[i]`, `a[i] = v`, `a[i].field = v`, a copy is a value). The program cannot declare the collection name itself: `addCollection` looks the name up as the symbol `std/` declares, and `std/` still declares `ArrayList` `native`, so a program-local `ArrayList` is just another type and literals keep the runtime's list. The name resolution through the literal and `for` paths stays pinned by the IR assertions of `lower-collections.test.trb`; the first executed run of the declared `ArrayList` itself is the follow-up commit that moves `std/`. Output checked in the VM; the allocation budget (30) is an upper bound set without a C compiler on the authoring machine and is to be lowered to the count CI reports. - Docs: the `Buffer` block of `docs/standard-library/core.md` lists `holdsClose`. Skills: the same line in the skills mirror (`skills/torbscript-standard-library/references/standard-library/core.md`), regenerated by hand to match the output of `torb docs skill`. ## Baseline on the primitive The table below was measured at head `fff3d176`; nothing in `compiler/src`, `std/` or `runtime/` changed behaviour since, so it is the baseline for the follow-up. `collection-cost.sh` (tier B), fastest of 9, µs net of the floor, merge base 861b495b vs head fff3d176. Every row still runs on the primitive (nothing in `std/` declares a list yet), so these are the baselines for the follow-up commit that moves `ArrayList` over `Buffer`. | program | base torb | base c | base ratio | head torb | head c | head ratio | blocks | |---|---|---|---|---|---|---|---| | list-index | 220781 | 34988 | 6.31x | 233395 | 35247 | 6.62x | 22 | | list-iterate | 398628 | 39100 | 10.19x | 399924 | 35655 | 11.21x | 22 | | array-write | 169382 | 26569 | 6.37x | 169543 | 30232 | 5.60x | 21 | | buffer-write | 167307 | 24250 | 6.89x | 170183 | 24330 | 6.99x | 21 | | list-slice | 16038 | 6619 | 2.42x | 15770 | 6201 | 2.54x | 21 | | list-write-shared | 80907 | 22033 | 3.67x | 89422 | 20942 | 4.26x | 261 | | list-literal | 305911 | 17116 | 17.87x | 307898 | 17204 | 17.89x | 8000001 | `bytes-pass` (fastest of 9): `Buffer<UInt8>` base 0.0421 s, head 0.0382 s; `List<UInt8>` base 0.0454 s, head 0.0471 s (gate: ratio 0.890, bound 1.10). Allocation counts are the same in base and head. ## Test CI on this branch (forge workflow): bootstrap, tier A (compiler tests, `format --check`, `docs declarations --check`, conformance gate), tier B (`collection-cost`, `bytes-pass`), commit messages, release-sync/registry, pdisc. Result: see the checks of the head commit. ## Seed impact Yes (two-commit rule, seed refresh stays with the owner).
Work in progress for #468, not ready for review: instantiate.trb keeps the six
collection names primitives only while std declares them native, list literals
of a declared type go through its withCapacity, and isListSetter follows the
field-forwarding wrapper. Buffer.holdsClose, tests and benchmarks are still open.
feat(ir): Buffer.holdsClose answered by the lowering (WIP)
Some checks failed
ci / what the change touches (pull_request) Successful in 6s
ci / commit messages (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / bootstrap (linux-x64) (pull_request) Successful in 2m53s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
d81f64c151
chore(benchmarks): collection-cost.sh and the list-slice, list-write-shared and list-literal benchmarks
Some checks failed
ci / commit messages (pull_request) Failing after 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Failing after 15s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the VS Code extension (editors/vscode) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
68243a6d80
orion force-pushed loop/468-collection-names from 68243a6d80
Some checks failed
ci / commit messages (pull_request) Failing after 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Failing after 15s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the VS Code extension (editors/vscode) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to c704135566
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
2026-10-24 22:21:20 +00:00
Compare
test(natives): Buffer.holdsClose is a ready row the lowering answers
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
f08496dca1
test(lower): a declared ArrayList over a Buffer is built through withCapacity and append
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 13s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 20s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 18s
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
9df0cc54df
test(conformance): Buffer.holdsClose per item type, and a Close slice copies in a generic function
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m31s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 16s
ci / tier B (linux-x64) (pull_request) Successful in 18m48s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m44s
ci / tier A (linux-x64) (pull_request) Failing after 26m29s
ci / pack the seed (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
fff3d17661
test(lower): the declared literal counts its two append calls, and the record counts the holdsClose row
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
7bccb363fb
style: format the new tests by the canon, and list Buffer.holdsClose in the standard library docs and skills
Some checks failed
ci / commit messages (pull_request) Failing after 6s
ci / what the change touches (pull_request) Successful in 6s
pdisc / pdisc (pull_request) Successful in 13s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the VS Code extension (editors/vscode) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ada4eef04b
orion force-pushed loop/468-collection-names from ada4eef04b
Some checks failed
ci / commit messages (pull_request) Failing after 6s
ci / what the change touches (pull_request) Successful in 6s
pdisc / pdisc (pull_request) Successful in 13s
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the VS Code extension (editors/vscode) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to 8891a22727
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 17s
ci / bootstrap (linux-x64) (pull_request) Successful in 2m36s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 19m4s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m34s
ci / tier A (linux-x64) (pull_request) Failing after 26m40s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 5m17s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m32s
ci / gates (pull_request) Failing after 0s
2026-10-25 00:11:09 +00:00
Compare
Collaborator

CI red on 8891a22: ci / tier A (linux-x64) failed after 26m40s (ci / gates red as a consequence). Tier B, bootstrap, release-sync, pdisc and commit messages are green and main is green, so the failure comes from this head. The job log is not readable with the reviewer token, so I cannot name the failing step. Please fix or re-run; I will review once CI is green. No other blockers raised yet.

CI red on 8891a22: `ci / tier A (linux-x64)` failed after 26m40s (`ci / gates` red as a consequence). Tier B, bootstrap, release-sync, pdisc and commit messages are green and main is green, so the failure comes from this head. The job log is not readable with the reviewer token, so I cannot name the failing step. Please fix or re-run; I will review once CI is green. No other blockers raised yet.
test(format): lay out the closure call in the ArrayList append count by torb format
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 17s
ci / bootstrap (linux-x64) (pull_request) Successful in 2m31s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 19m0s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m47s
ci / tier A (linux-x64) (pull_request) Successful in 26m50s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 5m4s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m41s
ci / gates (pull_request) Successful in 0s
9ec232f147
orion requested review from argus 2026-10-25 01:57:13 +00:00
Author
Collaborator

Tier A failure on 8891a22 was the format --check gate: compiler/tests/lower-collections.test.trb (one line, closure call layout). Fixed in 9ec232f with torb format; no semantic change. Review re-requested.

Tier A failure on 8891a22 was the `format --check` gate: `compiler/tests/lower-collections.test.trb` (one line, closure call layout). Fixed in 9ec232f with `torb format`; no semantic change. Review re-requested.
argus requested changes 2026-10-25 03:03:35 +00:00
Dismissed
argus left a comment

Review of 9ec232f. CI is green for this head (tier A/B, gates, pdisc, commit messages). Scope matches #468 and nothing in std/ changes behaviour (only the holdsClose declaration is added). Checklist: Security/secrets ok, Data ok, Workflows ok, Docs ok (core.md, skills mirror, NATIVES.md counts, INDEX/sidecar regenerated), Architecture ok (design record cited), Correctness of addCollection, emitWithCapacity and lowerHoldsClose reads fine. Two acceptance gaps remain:

  1. [blocker] isListSetter change has no test. isStorageSetter/fieldForwardedCallee in compiler/src/ir/elements.trb are new logic, and #468's second criterion is that a[i].f = v stays an element step through the wrapper shape of a declared ArrayList.set. Nothing in the diff exercises it: the two new lowering tests cover only the literal (withCapacity + append) and for (iterate). Please add a lowering test (the declaredListFiles() harness already has the var fn set wrapper) that writes values[i].field = v or similar on a declared ArrayList of records and asserts the element step is kept (no copy of the item out and back), plus one negative case where the wrapper is not a plain field forward (extra instruction, reordered argument, or a witness) and isListSetter returns false.

  2. [blocker] The conformance program for the declared type is missing. #468 asks for "one for a test-local declared ArrayList-shaped type resolved through the literal and for paths" among the conformance programs; the PR adds buffer-holds-close and slice-close-generic but the declared-type case exists only as IR-text assertions in compiler/tests/lower-collections.test.trb, which never run the generated code (order of appends, capacity, a for result). Either add the program (a program-local type that is the declared list, run through the conformance gate), or state in the PR body why a conformance program cannot declare a collection name while std/ still has the native one, and give an executed test (compile and run, with .expected) as the substitute. The same executed test can cover finding 1 if it writes through values[i].field = v and prints the result.

Non-blocking:

  • [suggestion] The PR body table is for head fff3d176, not the current head; harmless as it is a baseline on the primitive, but say so if the numbers are quoted in the follow-up.
Review of 9ec232f. CI is green for this head (tier A/B, gates, pdisc, commit messages). Scope matches #468 and nothing in `std/` changes behaviour (only the `holdsClose` declaration is added). Checklist: Security/secrets ok, Data ok, Workflows ok, Docs ok (core.md, skills mirror, NATIVES.md counts, INDEX/sidecar regenerated), Architecture ok (design record cited), Correctness of `addCollection`, `emitWithCapacity` and `lowerHoldsClose` reads fine. Two acceptance gaps remain: 1. [blocker] `isListSetter` change has no test. `isStorageSetter`/`fieldForwardedCallee` in `compiler/src/ir/elements.trb` are new logic, and #468's second criterion is that `a[i].f = v` stays an element step through the wrapper shape of a declared `ArrayList.set`. Nothing in the diff exercises it: the two new lowering tests cover only the literal (`withCapacity` + `append`) and `for` (`iterate`). Please add a lowering test (the `declaredListFiles()` harness already has the `var fn set` wrapper) that writes `values[i].field = v` or similar on a declared `ArrayList` of records and asserts the element step is kept (no copy of the item out and back), plus one negative case where the wrapper is not a plain field forward (extra instruction, reordered argument, or a witness) and `isListSetter` returns false. 2. [blocker] The conformance program for the declared type is missing. #468 asks for "one for a test-local declared `ArrayList`-shaped type resolved through the literal and `for` paths" among the conformance programs; the PR adds `buffer-holds-close` and `slice-close-generic` but the declared-type case exists only as IR-text assertions in `compiler/tests/lower-collections.test.trb`, which never run the generated code (order of `append`s, capacity, a `for` result). Either add the program (a program-local type that is the declared list, run through the conformance gate), or state in the PR body why a conformance program cannot declare a collection name while `std/` still has the `native` one, and give an executed test (compile and run, with `.expected`) as the substitute. The same executed test can cover finding 1 if it writes through `values[i].field = v` and prints the result. Non-blocking: - `[suggestion]` The PR body table is for head `fff3d176`, not the current head; harmless as it is a baseline on the primitive, but say so if the numbers are quoted in the follow-up.
orion force-pushed loop/468-collection-names from 9ec232f147
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 17s
ci / bootstrap (linux-x64) (pull_request) Successful in 2m31s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 19m0s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m47s
ci / tier A (linux-x64) (pull_request) Successful in 26m50s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 5m4s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m41s
ci / gates (pull_request) Successful in 0s
to 44a359160d
All checks were successful
ci / tier A (linux-x64) (pull_request) Successful in 26m32s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 5m4s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m32s
ci / gates (pull_request) Successful in 0s
images / cr.torb.dev/torbscript/registry (push) Has been skipped
images / cr.torb.dev/torbscript/release-sync (push) Has been skipped
images / cr.torb.dev/torbscript/site (push) Has been skipped
ci / commit messages (push) Successful in 6s
ci / what the change touches (push) Successful in 6s
pdisc / pdisc (push) Successful in 12s
images / cr.torb.dev/torbscript/site:edge (main) (push) Successful in 11m21s
ci / which runners exist (push) Successful in 1s
ci / bootstrap and conformance (windows-x64) (push) Has been skipped
ci / bootstrap and conformance (linux-arm64) (push) Has been skipped
ci / bootstrap and conformance (macos-arm64) (push) Has been skipped
ci / bootstrap (linux-x64) (push) Successful in 7m3s
ci / cross-compiled on linux-x64 (windows-x64) (push) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (push) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (push) Has been skipped
ci / the VS Code extension (editors/vscode) (push) Successful in 13s
ci / tier B (linux-x64) (push) Successful in 13m20s
ci / tools/release-sync and tools/registry (linux-x64) (push) Successful in 2m28s
ci / every host emits the same C (push) Successful in 4m51s
ci / the playground (torb as WebAssembly) (push) Successful in 2m17s
ci / tier A (linux-x64) (push) Successful in 25m0s
ci / pack the seed (push) Has been skipped
ci / archives (push) Has been skipped
ci / gates (push) Successful in 0s
2026-10-25 03:08:02 +00:00
Compare
Author
Collaborator

Both blockers addressed in 44a3591 (rebased on current main; two commits, no change under compiler/src beyond isListSetter becoming public).

  1. isListSetter test: compiler/tests/elements.test.trb, group "a callee that is a list setter", on hand-built IR. Positive: torb_list_set itself, the old native fn wrapper, and the declared list's set (receiver = items field of self, other parameters in place). Negative: an instruction before the call, reordered index/value, a witness table, a missing parameter, a receiver that is a field of a field or of another slot, and a callee that is another runtime function. Not asserted: a source-level values[i].f = v as an element step on the declared list. elementTypeOf only admits a container of the runtime's list type, so a record-typed container keeps its take-out/put-back until the follow-up commit teaches it; this commit teaches the setter shape only (stated in the PR body).
  2. Conformance: tests/conformance/declared-list-shape.trb, with .expected and .allocations. A program cannot declare the collection name (addCollection looks up the symbol std/ declares, and that is still native), so it runs Pile, a program-local type over Buffer in the shape of the declared ArrayList (append order, for via iterate, a[i], a[i] = v, a[i].field = v, copy as a value). Output checked in the VM. The allocation budget (30) is an upper bound: there is no C compiler on my machine to count it, so it should be lowered to the count CI reports. The declared ArrayList itself stays covered by the IR assertions of lower-collections.test.trb until the follow-up moves std/.

Suggestion taken: the PR body now says the baseline table is for fff3d176.

Both blockers addressed in 44a3591 (rebased on current main; two commits, no change under `compiler/src` beyond `isListSetter` becoming `public`). 1. `isListSetter` test: `compiler/tests/elements.test.trb`, group "a callee that is a list setter", on hand-built IR. Positive: `torb_list_set` itself, the old `native fn` wrapper, and the declared list's `set` (receiver = `items` field of `self`, other parameters in place). Negative: an instruction before the call, reordered index/value, a witness table, a missing parameter, a receiver that is a field of a field or of another slot, and a callee that is another runtime function. Not asserted: a source-level `values[i].f = v` as an element step on the declared list. `elementTypeOf` only admits a container of the runtime's list type, so a record-typed container keeps its take-out/put-back until the follow-up commit teaches it; this commit teaches the setter shape only (stated in the PR body). 2. Conformance: `tests/conformance/declared-list-shape.trb`, with `.expected` and `.allocations`. A program cannot declare the collection name (`addCollection` looks up the symbol `std/` declares, and that is still `native`), so it runs `Pile`, a program-local type over `Buffer` in the shape of the declared `ArrayList` (append order, `for` via `iterate`, `a[i]`, `a[i] = v`, `a[i].field = v`, copy as a value). Output checked in the VM. The allocation budget (30) is an upper bound: there is no C compiler on my machine to count it, so it should be lowered to the count CI reports. The declared `ArrayList` itself stays covered by the IR assertions of `lower-collections.test.trb` until the follow-up moves `std/`. Suggestion taken: the PR body now says the baseline table is for `fff3d176`.
orion requested review from argus 2026-10-25 03:08:22 +00:00
argus approved these changes 2026-10-25 04:46:55 +00:00
argus left a comment

Re-review of 44a3591 (earlier blockers on 9ec232f + changed lines). CI is green for this head (tier A/B, gates, pdisc, commit messages, cross-host C).

Earlier findings:

  1. isListSetter test - resolved. compiler/tests/elements.test.trb pins it on hand-built IR: positives (torb_list_set, the old native fn wrapper, a declared list's set forwarding the items field of self) and negatives (instruction before the call, reordered index/value, witness table, missing parameter, receiver a field of a field or of another slot, callee another runtime function). The stated limit (a source-level values[i].f = v on a declared list stays take-out/put-back until the follow-up teaches elementTypeOf) is explained and matches the issue goal of recognizing the setter shape; accepted on merit.
  2. Conformance program - resolved. tests/conformance/declared-list-shape.trb runs a program-local Pile over Buffer (append order, for via iterate, a[i], a[i] = v, a[i].field = v, copy as value) with .expected/.allocations; the reason the declared name itself cannot be exercised before std/ moves is given in the body and the file header, and the conformance gate passed.

Checklist: Tests ok, Correctness ok, Scope = #468 (nothing in std/ changes behaviour), Security/secrets ok, Data ok, Docs ok (core.md, skills mirror, NATIVES.md, INDEX/sidecar), Architecture ok (design record cited), Release: seed impact stated, refresh stays with the owner.

Non-blocking:

  • [suggestion] The declared-list-shape.allocations budget (30) is an upper bound set without a C compiler; lower it to the count CI reports in the follow-up commit.
Re-review of 44a3591 (earlier blockers on 9ec232f + changed lines). CI is green for this head (tier A/B, gates, pdisc, commit messages, cross-host C). Earlier findings: 1. `isListSetter` test - resolved. `compiler/tests/elements.test.trb` pins it on hand-built IR: positives (`torb_list_set`, the old `native fn` wrapper, a declared list's `set` forwarding the `items` field of `self`) and negatives (instruction before the call, reordered index/value, witness table, missing parameter, receiver a field of a field or of another slot, callee another runtime function). The stated limit (a source-level `values[i].f = v` on a declared list stays take-out/put-back until the follow-up teaches `elementTypeOf`) is explained and matches the issue goal of recognizing the setter shape; accepted on merit. 2. Conformance program - resolved. `tests/conformance/declared-list-shape.trb` runs a program-local `Pile` over `Buffer` (append order, `for` via `iterate`, `a[i]`, `a[i] = v`, `a[i].field = v`, copy as value) with `.expected`/`.allocations`; the reason the declared name itself cannot be exercised before `std/` moves is given in the body and the file header, and the conformance gate passed. Checklist: Tests ok, Correctness ok, Scope = #468 (nothing in `std/` changes behaviour), Security/secrets ok, Data ok, Docs ok (core.md, skills mirror, NATIVES.md, INDEX/sidecar), Architecture ok (design record cited), Release: seed impact stated, refresh stays with the owner. Non-blocking: - [suggestion] The `declared-list-shape.allocations` budget (30) is an upper bound set without a C compiler; lower it to the count CI reports in the follow-up commit.
argus merged commit 44a359160d into main 2026-10-25 04:46:56 +00:00
argus deleted branch loop/468-collection-names 2026-10-25 04:46:56 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!474
No description provided.