Files
AILang/examples/fieldtest/rbx_3_unit_element_reject.ail
T
Brummel 1b2d23ec42 fieldtest: raw-buf comprehensive — 4 examples, 8 findings (refs #7)
Comprehensive usability re-test of the RawBuf kernel extension in
natural LLM-author decompositions the prior field test (0058) did not
exercise: a Float RawBuf in a user ADT read through two borrow helpers,
a Bool flag buffer filled with a computed value, an Int fib buffer whose
fill reads its own writes plus two composed borrow summaries, and a
forbidden core-primitive element. All three working fixtures build, run
to expected values, and report live=0 across Float/Bool/Int widths —
the core RawBuf surface (borrow-helper composition, fill loops,
RawBuf-in-ADT, element widths) genuinely holds together.

Orchestrator triage corrected the fieldtester's run, which executed a
stale target/release/ail (built before the #50 fix). Every outcome was
re-verified against a fresh build:

- F2 (bare RawBuf ADT field unresolved) — RETRACTED: a stale-binary
  false positive. On a fresh build the bare name resolves in every
  configuration (ctor name == or != type name; builds/runs live=0). The
  #50 fix is correct and general.
- F7 (NEW, issue #51) — a `check`-clean program crashes `build`: a
  buffer whose element type is never observed by a later get/set
  defaults its element to Unit in monomorphisation and hits an
  unregistered `RawBuf_new__Unit` intercept. Affects a legitimate
  `RawBuf<Int>` used only for its size AND a forbidden locally-
  constructed element. Root: the `(new T ...)` desugar drops the
  explicit element annotation; honouring it reverses the milestone's
  § Term::New desugar decision, so it routes through brainstorm.
- F8 (process) — the field test ran stale; the fieldtester agent now
  builds from the current tree before running (plugin fix).

F1 (spec_gap) resolved here: the design ledger's §Series substrate ctor
wrote the storage field `(own (RawBuf a))`, which does not parse (`own`
is fn-param/ret only). Rewritten to the verified-authorable `(con RawBuf
a)`. The rest of the §Series listing is illustrative and its element-
less `(new RawBuf lookback)` construction is entangled with #51; a full
compile-verification of that listing belongs with the Series-substrate
work.

F5 (param-in rejects a forbidden core primitive, message names the set)
and F4/F3 (borrow composition; substrate composite) carry on. F6
(param-in set rendered as a Rust-debug list) filed as #52.

refs #7
2026-05-30 18:29:00 +02:00

30 lines
1.2 KiB
Plaintext

; Fieldtest raw-buf comprehensive .3 (Axis 5 — the param-in element-type
; restriction on a forbidden *core primitive*).
;
; The prior field test rejected RawBuf<Str> (the shipped fixture) and
; RawBuf<Tick> (a user ADT). This probes the third natural mistake: a
; RawBuf of `Unit` — a core primitive that is NOT in the allowed set
; {Int, Float, Bool}. An LLM author might reach for `RawBuf<Unit>` as a
; "presence buffer" / counter-of-slots before realising a Bool flag
; buffer is the right tool. The restriction must reject it, and per the
; B3 fix (#48) the diagnostic should now NAME the allowed set
; {Int, Float, Bool}, not just the offending type.
;
; Expected: `ail check` exits 1 with [param-not-in-restricted-set]
; naming `Unit` AND the allowed set {Int, Float, Bool}.
(module rbx_3_unit_element_reject
(fn make_presence
(doc "Try to allocate a RawBuf of Unit — forbidden element type.")
(type (fn-type (params (con Int)) (ret (own (con RawBuf (con Unit))))))
(params n)
(body (new RawBuf (con Unit) n)))
(fn main
(type (fn-type (params) (ret (con Unit)) (effects IO)))
(params)
(body
(let buf (app make_presence 3)
(do io/print_str "unreachable\n")))))