cli: resolve struct len fields by receiver type

Use ordinary field lowering and declared field types for nominal receivers while preserving array and slice lengths. Make array field type hints available to chained access. Missing struct len now reports E7002 instead of the builtin-length E7005.

Add 15 source regressions and imported generic CLI checks. Unit tests, all 1201 conformance cases, per-instruction collection for new cases, formatter corpus and original public check/lower compatibility pass.
This commit is contained in:
dev committed 2026-10-07 20:50:48 +03:00
1 parent 184cb7b321
commit 1495650587
18 files changed
+244 -4

No files matched your search

+7 -1
View File
@@ -197,4 +197,10 @@ No language/spec, AIR, diagnostic, verifier or interpreter rule changes. Existin
Validation: unit tests and full conformance pass, 1,186/1,186. All five reference pairs pass with 200 schedule seeds and collection before every instruction. New CI checks pass 3,662 CLI calls: every example/package, independent journal encoding/CRC/offset checks, overflow without writes, partial hosted writes, and concurrent source/AIR record equality at 200 seeds across three quanta. Linux raises the failed file's quota before retry to verify poisoning; the branch without `prlimit` also passes, retaining the original quota. Independent Claude review found the old-file offset error and two integration issues; these are corrected. A separate formatter correction preserves spaces in unpack/grouped range forms, with a failing-before/passing-after unit test and CLI AIR-fidelity test. Source Bundle hashes are unchanged for all 16 files; Quick Reference, AIR and token budgets do not grow. Frozen evaluation inputs remain unchanged.
Separate P6-5 implementation follow-up: a struct field named `len` currently reaches the array/slice `.len` path and rejects E7005. Spec 15 §5 already permits ordinary struct field access; fixing that dispatch requires no new language design. The executable header uses the explicit field name `length`.
## P6-5 fields named `len` (2026-10-07)
The implementation follow-up from P6-9 is resolved: nominal values and `ref`/`mut` receivers dispatch `.len` through ordinary field access, using the declared field type. Array field types are also available to inference for chained access such as `header.len.len`. Arrays and slices, including slices of structs, retain their built-in length behavior. Spec 15 §5 already defines these rules; no spec, bundle, AIR, verifier or interpreter change is required.
Existing borrow/load/end and whole-value ownership rules remain authoritative: reading a Copy field succeeds, conflicting borrows reject E2101, and projecting a linear field rejects E1001. Missing struct fields now produce E7002 with `type` and `field`, replacing the misleading array/slice E7005. Enum field access and type mismatches retain E7005. A struct length field does not prove slice bounds: the out-of-bounds regression still traps T0008. This restores specified source behavior without changing accepted AIR semantics or runtime state.
Validation: full conformance passes 1,201/1,201, including all 15 new cases; the new cases also pass with collection before every instruction. Unit tests, generic CLI integration (32 checks), formatting checks and coverage (120/120) pass. The formatter passes 3,437 checks over 916 public files, with 582 identical successful AIR outputs. Imported generic fields preserve declared types, source locations and source/AIR run-record parity. Across 1,233 original public files, all 2,134 check/lower results agree after normalizing absolute versus relative diagnostic file paths; all 570 successful source lowerings are byte-identical. Independent read-only Claude review found no remaining issues. P6-5 remains open for its other source-layer work.