Files
AILang/examples/fieldtest/series-step1_4_paramin_str_reject.ail
T
Brummel 3b3c8c4f07 fieldtest(series-step1): 5 examples, 5 findings (1 bug, 1 friction, 1 spec-gap)
Post-ship field test of the shipped `series` library extension as a
downstream Form-A author working from the public surface only. Five
fixtures under examples/fieldtest/ across the construction/auto-import,
ring-buffer/financial-indexing, len/total_count bookkeeping, param-in
error-quality, and operator-naming axes; spec at
docs/specs/0067-fieldtest-series-step1.md.

Wins (carry-on): auto-import works with no `(import series)`; the
financial index (0 = newest) maps directly onto the bounded-buffer
mental model and stays correct after multiple wraps; the param-in
diagnostic for a disallowed element type names the type, the
type-variable, the qualified type, and the allowed set.

Findings routed:
- [bug] An owned ADT threaded through tail-recursion whose base case
  neither returns nor consumes it is never dropped — a general
  drop-soundness leak (a plain `Box` control with no Series/RawBuf
  also leaks). Series surfaces it heavily on the whitepaper's headline
  streaming pattern, and the committed reference examples/series_sma.ail
  itself leaks (live=8). Minimal repro: series-step1_5 (live=4).
- [friction] `ail describe ... Series.push` (the canonical type-scoped
  form) reports module-not-found; only `series.push` / bare `push`
  resolve, and no command lists a type's op set.
- [spec_gap] referencing a kernel base type (`RawBuf`) from a user ADT
  ctor field requires full qualification (`raw_buf.RawBuf`) while bare
  `Series` works in type-position via auto-import — the asymmetry is
  undocumented.

The fixtures that leak still produce correct output; the leak is a
separate observable under AILANG_RC_STATS and an orthogonal,
pre-existing bug, not a Series defect.

refs #61
2026-06-02 13:22:30 +02:00

28 lines
1.1 KiB
Plaintext

; Fieldtest series-step1.4 (MUST FAIL) — param-in error quality for a
; disallowed element type.
;
; Task framing: an author who has used Series for Int/Float reaches for
; "a ring of the last N log lines" — i.e. (con Series (con Str)). The
; element type Str is NOT in Series's param-in set {Int, Float}, so this
; must be rejected. The axis question is the QUALITY of the diagnostic:
; - does it name Series and the offending type Str?
; - does it state the allowed set?
; - does it point at a location?
;
; This fixture is otherwise valid: a single push of a Str literal into a
; Series of Str. The ONLY defect is the element type.
;
; Expected: `ail check` rejects. The whitepaper (0007 §param-in) names the
; diagnostic ParamNotInRestrictedSet, "naming the offending type and the
; allowed set." We record what actually surfaces.
(module series-step1_4_paramin_str_reject
(fn main
(type (fn-type (params) (ret (own (con Unit))) (effects IO)))
(params)
(body
(let s (new Series (con Str) 3)
(let s2 (app Series.push s "hello")
(do io/print_str "unreachable\n"))))))