Commit Graph

213 Commits

Author SHA1 Message Date
Brummel dd9614cae9 iter 22b.4a.3: form-a printer arm for ClassDef 2026-05-09 22:10:35 +02:00
Brummel da1746229d iter 22b.4a.2: form-a parser arm for InstanceDef 2026-05-09 22:05:49 +02:00
Brummel a1b4cd0063 iter 22b.4a.1.fix: drop test comments narrating plan deviations 2026-05-09 22:03:27 +02:00
Brummel eb06f3bfcc plan: 22b.4a fix — int literals are bare tokens, not (lit (int N)) 2026-05-09 22:00:55 +02:00
Brummel fefaa03c76 iter 22b.4a.1: form-a parser arm for ClassDef 2026-05-09 21:59:29 +02:00
Brummel fdf0de5de7 plan: 22b.4a form-a parser+printer arms for ClassDef/InstanceDef 2026-05-09 21:55:25 +02:00
Brummel eef5197f75 iter 22b.3: JOURNAL — monomorphisation pass shipped, e2e gate green 2026-05-09 21:37:51 +02:00
Brummel 090f082215 iter 22b.3.tester: e2e for coherence, default-keyword, cross-module mono
Adds three end-to-end tests for the 22b.3 mono pass, each with a
matching one-property fixture under examples/. Defends mono-pass
invariants 3, 4, and 6 from docs/specs/2026-05-09-22-typeclasses.md
at the binary level (stdout-asserting, not AST-asserting):

- coherence_two_instances_pick_correct_body_at_runtime — class R
  with instances at Int and Bool, both reachable from one main.
  Stdout `11\n22` proves both mono fns are synthesised AND each
  call site picks the matching body (no collapse).

- class_default_method_runs_and_prints_default_value — empty
  instance body + class-level `default` clause must lower, link,
  and print the default value (`99`). Promotes the existing
  synthesise_mono_fn unit test to a binary-level guarantee.

- cross_module_class_method_runs_and_prints_correct_value —
  class+instance in module A, called from module B's main. The
  qualified-name rewrite + cross-module synth-def placement was
  AST-tested in 22b.3.6; this pins down the emit-and-link path.

All 18 typeclass_22b3 tests pass; full workspace green; 3 bench
gates 0/0/0.
2026-05-09 21:36:15 +02:00
Brummel b59820b737 iter 22b.3.7: synthetic fixture — class+instance compiles, runs, prints 5 2026-05-09 21:28:41 +02:00
Brummel 7f260b82ad iter 22b.3.6: fix — quality-review (shadow-aware walker, cross-mod test, Option-typed targets, const helper) 2026-05-09 21:21:33 +02:00
Brummel d1b590ceab iter 22b.3.6: call-site rewrite — same/cross module qualified names 2026-05-09 21:07:58 +02:00
Brummel e8018d48b6 iter 22b.3.5: fix — quality-review (chained-call test, hoist class_index, drop noise comments) 2026-05-09 20:59:43 +02:00
Brummel dd87b36e00 iter 22b.3.5: workspace fixpoint loop — dedup + synth-append 2026-05-09 20:52:07 +02:00
Brummel d2954010ea iter 22b.3.4: fix — quality-review (zero-arg test, drop what-comments + param-name pin) 2026-05-09 20:45:56 +02:00
Brummel d6084a71fb iter 22b.3.4: synthesise_mono_fn — instance body + class default fallback 2026-05-09 20:41:45 +02:00
Brummel 9f86c072dc iter 22b.3.3: fix — revert dead pub(crate), reuse build_module_types, drop defensive unwrap
Quality-review follow-up to 89311ee:

- Revert `substitute_rigids` to private. Task 3 does not call it; the
  visibility bump was forward-looking for Task 4 (synthesise_mono_fn).
  Task 4 will re-bump it in the same diff that uses it.
- Promote `build_module_types` to pub(crate); drop the inline
  reimplementation in `mono::build_workspace_env`. Removes drift risk
  between the two paths.
- Replace defensive `unwrap_or_default()` on `build_module_globals`
  with `expect(...)` naming the pre-condition. Silent default violated
  CLAUDE.md "no defensive validation in internal code paths".
- Add a one-line drift-risk reminder at the top of `build_workspace_env`
  flagging that it and `check_in_workspace` both populate `Env`.

Build clean; all 5 typeclass_22b3 tests green; no workspace regressions.
2026-05-09 20:36:52 +02:00
Brummel 89311ee20b iter 22b.3.3: collect_mono_targets — synth-replay residual gathering 2026-05-09 20:31:12 +02:00
Brummel c77fd1b85e iter 22b.3.2: fix — drop speculative Float (plan-text overreach)
Float is referenced nowhere else in the codebase; the plan-text
listed it aspirationally. Restored parity with the four other
primitive enumerations across the crate. When Float lands as a
real type (post-22b.4 Prelude work, if at all), the arm gets
re-added in the same iter that introduces Type::float().

Deferred (not part of this fix):
- Shared-constant extraction across the four primitive enumeration
  sites (linearity.rs:143, lib.rs:1232/2214, mono.rs) — workspace-
  level cleanup belonging to the milestone-22 audit phase.
- pub mod mono vs sibling pub use lift::lift_letrecs style — plan
  prescribed pub mod for 22b.3 because Tasks 3-7 add multiple pub
  items reached by integration tests; per-item pub use would
  proliferate.
2026-05-09 20:25:51 +02:00
Brummel 028227587b iter 22b.3.2: mono_symbol — primitive surface forms + hash for compound 2026-05-09 20:21:24 +02:00
Brummel 108115f7dd iter 22b.3.1: fix — quality-review (doc reframe + class-present test) 2026-05-09 20:18:20 +02:00
Brummel 209074ee5d iter 22b.3.1: mono pass skeleton — identity for class-free workspaces 2026-05-09 20:12:36 +02:00
Brummel f7791e6cbd plan: 22b.3 monomorphisation pass 2026-05-09 20:08:01 +02:00
Brummel b1ae865e9d iter 22b.2: typecheck arms — 8 diagnostics shipped + skill-system post-mortem 2026-05-09 19:21:38 +02:00
Brummel 73965a6cbd iter 22b.2.e2e: cross-module class resolution + multi-fn aggregation
Four new E2E tests in typeclass_22b2.rs covering invariants the
per-task fixtures (all single-module, single-fn) did not exercise:

- cross_module_class_method_resolves_and_fires_no_instance:
  module B's call to `show` (declared in module A) reaches the
  no-instance arm, proving Env.class_methods is merged workspace-
  wide and not restricted to the local module.
- cross_module_polymorphic_fn_without_constraint_fires_missing_constraint:
  same merge guarantees the missing-constraint arm sees the residual
  produced by a call to A's class method from inside B.
- cross_module_instance_satisfies_concrete_call: the workspace
  registry built at load time over all modules must populate keys
  visible from B; a concrete call resolves clean cross-module.
- two_fns_each_missing_constraint_produce_two_diagnostics: pins
  check_in_workspace's per-def aggregation — two ill-formed fns
  produce two diagnostics (one per fn), not one.

Six new fixtures (xmod_* trio + two_fns_*).
2026-05-09 19:19:44 +02:00
Brummel 47bec74b26 iter 22b.2.10: fix — positive green-path test, drop dead let _ = ws
Adds the missing positive counterpart to the no-instance test:
`show 42` with `instance Show Int` PRESENT must typecheck green.
This guards against registry-keying or threading bugs that would
otherwise sneak past the negative-only test (an empty registry at
typecheck time, or a key shape mismatch, would silently fire
no-instance even when the instance exists).

Also drops the dead `let _ = ws;` and its stale comment in
`check_in_workspace` — the line above already consumes
`ws.registry`, so the explicit drop is redundant. The remaining
comment is folded into the registry-threading comment so the
"registry is the only thing threaded" rationale is preserved.
2026-05-09 19:13:32 +02:00
Brummel 3600e82ec2 iter 22b.2.10: no-instance per-fn diagnostic 2026-05-09 19:07:46 +02:00
Brummel b741a8ba05 iter 22b.2.9: fix — superclass-walk tests, simplify class_superclasses map shape 2026-05-09 18:59:15 +02:00
Brummel 7cff741632 iter 22b.2.9: missing-constraint per-fn diagnostic 2026-05-09 18:51:39 +02:00
Brummel afa06a3f3d iter 22b.2.8: fix — fold double-match, IndexMap parity, broader contract test 2026-05-09 18:37:49 +02:00
Brummel 17605a3327 iter 22b.2.8: register class methods in module globals 2026-05-09 18:33:01 +02:00
Brummel 6869bd5d0c iter 22b.2.7: fix — cycle termination guard, hoist type_repr 2026-05-09 18:23:52 +02:00
Brummel ae7281ac41 iter 22b.2.7: fix — use examples_dir() helper in superclass-instance test 2026-05-09 18:20:18 +02:00
Brummel a546c5851c iter 22b.2.7: missing-superclass-instance diagnostic 2026-05-09 18:18:12 +02:00
Brummel b252f837af iter 22b.2.6: fix — structural Origin enum, fn-fn collision delegation, test path helper
Address quality review of a9aa248:

- Replace string-prefix discriminator (`prior.starts_with("class ")`)
  with a structural `Origin { Class | Fn }` enum; `kind` is now a
  `match` on variants, formatting is reserved for error construction.
- Fix fn-fn collision misreport: in the `Def::Fn` arm, only fire
  `MethodNameCollision` when the prior origin is a class. Two
  `Def::Fn` with the same name are `CheckError::DuplicateDef`'s job
  in `ailang-check`, not this pre-pass.
- Tests use `examples_dir()` like the rest of the module; path
  construction is no longer ad-hoc.
- Tests assert `first_origin` / `second_origin` so an origin-format
  regression cannot silently break the `kind` discriminator.
- Drop forward-looking 22b.4 prelude reservation note from the
  variant doc — keep only what's load-bearing for 22b.2.
2026-05-09 18:13:49 +02:00
Brummel a9aa248910 iter 22b.2.6: method-name-collision diagnostic 2026-05-09 18:07:52 +02:00
Brummel 1f6d2322c3 iter 22b.2.5: fix — move OverridingNonExistentMethod after UnboundConstraintTypeVar 2026-05-09 18:01:51 +02:00
Brummel 634bd5eca3 iter 22b.2.5: overriding-non-existent-method diagnostic 2026-05-09 17:59:10 +02:00
Brummel 257b47625d iter 22b.2.4: constraint-references-unbound-type-var diagnostic 2026-05-09 17:54:20 +02:00
Brummel 4b84e781d4 iter 22b.2.3: invalid-superclass-param class-schema diagnostic 2026-05-09 17:50:29 +02:00
Brummel 928deb9d74 iter 22b.2.2: kind-mismatch class-schema diagnostic 2026-05-09 17:45:27 +02:00
Brummel 04bde14a9e iter 22b.2.1: fix — revert PartialEq semantic change, drop unused derives 2026-05-09 17:38:20 +02:00
Brummel b636b883a3 iter 22b.2.1: add Constraint struct, Type::Forall.constraints 2026-05-09 17:34:39 +02:00
Brummel e1d748d64e refactor: agents adopt skill-system methodology, add named reviewers
All six existing agents (implementer, tester, architect, bencher,
docwriter, debugger) restructured into the same superpowers-derived
layout the SKILL.md files use: Iron Law, Carrier contract, Standing
reading list, Status protocol (DONE / DONE_WITH_CONCERNS /
NEEDS_CONTEXT / BLOCKED), Common Rationalisations, Red Flags. Agents
now know about docs/specs/<milestone>.md and docs/plans/<iteration>.md
but do not open them directly — context curation lives at the skill
level (controller hands the agent task_text, hypothesis, etc.).

Implementer carries TDD as an independent discipline layer, mirroring
the superpowers split between subagent-driven-development (outer loop)
and test-driven-development (inner loop). RED-first applies even when
a plan task forgot to script the failing test.

Debugger scope corrected: RED-first only, hands GREEN to implement
mini-mode. Previously the agent self-applied the fix, which
contradicted skills/debug/SKILL.md Phase 4. The skill is the source
of truth; the agent now matches it.

Two new named reviewer agents:
- ailang-spec-reviewer: did the diff match the task text?
- ailang-quality-reviewer: is the diff well-built? (only after spec
  is compliant)

Both replace the ad-hoc general-purpose dispatch in skills/implement
Step 2.3 and 2.4. With named agents, AILang quality conventions are
amortised across dispatches instead of being re-stated inline per
prompt.

skills/implement/SKILL.md updated to dispatch the new reviewers.
skills/README.md agent roster expanded; conventions clarified to
state that agents do not open plan/spec files directly.
2026-05-09 17:16:24 +02:00
Brummel 7045b2f4d2 plan: 22b.2 typecheck arms 2026-05-09 16:46:29 +02:00
Brummel 71dea8eab6 spec: 22 milestone — typeclasses retrospective 2026-05-09 16:27:50 +02:00
Brummel 9b97a862f6 refactor: drop superpowers references in SKILL.md, add .claude/skills/ discovery
The skills are functionally complete and standalone — superpowers
references were attribution-only. Removed so a reader without the
superpowers plugin loaded isn't sent chasing dead links.

Plus: .claude/skills/<name> symlinks so Claude Code's Skill tool can
invoke them by name (analogous to the existing .claude/agents/
symlinks). Discovery section in skills/README.md updated to cover
both symlink sets.
2026-05-09 16:00:22 +02:00
Brummel ad6e4119a0 refactor: drop agents/ stub, move roster to skills/README.md
agents/ contained only README.md after the 2026-05-09 migration. The
roster information is more naturally located alongside the skills it
points into. skills/README.md is now the single index (skill table,
pipeline diagram, agent roster, discovery, conventions, how-to-add).

CLAUDE.md updated: code-layout entry consolidated, @-reference points
to skills/README.md.
2026-05-09 15:54:21 +02:00
Brummel a5bfb76c7b iter 22c.live: skill system shipped, JOURNAL entry 2026-05-09 14:25:30 +02:00
Brummel 0bbeceea46 docs: agents/README.md — rewritten as roster of skill-bound agents 2026-05-09 14:24:41 +02:00
Brummel 3330a74afc refactor: split CLAUDE.md — discipline detail to skills, pointers stay
294 -> 245 lines. Migrated:
  Bug fixes — TDD, always       -> skills/debug/SKILL.md
  Iter cycle / Tidy-iter        -> skills/audit/SKILL.md (renamed Milestone cycle)
  Performance regressions       -> skills/audit/SKILL.md
  Feature acceptance LLM utility -> skills/brainstorm/SKILL.md (gate)

CLAUDE.md keeps headline rules and one-line pointers. New 'Skill
system' section near the top introduces the five skills.
2026-05-09 14:24:02 +02:00