summary_corpus-sweep-2026-10-18.md 3.1 KB

Session summary — corpus sweep (2026-10-18)

Branch resolve-check, tree clean. Suite 223/223; fixpoint OK (3,731,524 bytes); corpus 382/612 compile-OK, 0 crashes.

Tags: v3-builtins-odd-trunc-float, v3-bool-enum-array-bounds, v3-set-of-enum, v3-fwd-set-of-type, v3-corpus-382, v3-corpus-sweep-2026-10-18.

What this session did

Continued the corpus-driven language work (the top backlog item from docs/STATUS.md): re-measured, then fixed the bounded gaps one at a time, each with a suite test. Corpus 372 → 382 (+10 files), 0 crashes.

Commit Tag Change Corpus
368b20d v3-builtins-odd-trunc-float ODD(x) → (x&1)<>0; TRUNC/FLOAT as VAL sugar 372 → 376
0c7fa60 v3-bool-enum-array-bounds BOOLEAN/ENUM array bounds + indices (BoundPair accepts ClBool/ClEnum; 218 accepts a BOOLEAN index) 376 → 381
d76822a v3-set-of-enum SET OF <enum> literals (BaseSpanOk accepts an enum base) 381
1de6c16 v3-fwd-set-of-type forward type ref in SET OF <type> (SymTab.Unresolved + deferred SetType span check) 381 → 382

New tests: t_truncfloat, t_enumidx, t_setenum, t_fwdset.

Side note: t_bad_index had asserted a non-error (BOOLEAN is a legal ordinal index) — changed to use a REAL index.

Findings recorded (not fixed — features, not one-liners)

docs/analysis_gaps.md §9:

  1. Set constants (CONST Digits = CharSet{"0".."9"}). Accepting the declaration is easy (treat ClSet as an aggregate in ConstDecl and the designator's KindConst branch — written, then reverted): the value needs static data, but a set literal is a runtime temp and QbeGen.DeclSet only emits a zeroed blob. The fix is a parse-time mask emitted as data $X = { w <mask>… } + a Lower re-emit path. Reverted to a clear 230 rather than miscompile.
  2. Builtin calls in CONST (CAP(VAL(CHAR,65)), MIN/MAX of sets): CAP/ABS/ODD set the "@" sentinel so ConstDecl's IsImm rejects them; fix is to fold builtins over immediates.

Tooling / workflow

Switched scratch space to a repo-local .scratch/ (gitignored, never committed) because /tmp/opencode is wiped between days:

  • corpus wrapper ./.scratch/corpusx.sh (work dir .scratch/v3corpus/),
  • repro modules (.scratch/*.mod),
  • fixpoint staging via TMP=$PWD/.scratch/fixpoint.

Docs refreshed: README.md, docs/STATUS.md (numbers), docs/INDEX.md (navigation), docs/analysis_gaps.md §8–§9.

Resume

cd .../m2compiler-V3
git checkout resolve-check                  # HEAD d3aad6f
cd compiler && ./build.sh && ./run_tests.sh # 223/223
cd .. && TMP="$PWD/.scratch/fixpoint" ./bootstrap/fixpoint.sh

# corpus (local scratch):
M2FLAGS="" ./.scratch/corpusx.sh            # 382 OK, 0 crash

Next

  • Set constants (static mask) and builtin CONST folding — the two recorded features.
  • Wider corpus buckets: SET OF over wide bases, ValLabel, ImpName, parser ident/':'/END expected cases; and the long-standing size-sensitive V3 miscompile.