iter remove-mut-var-assign.1: atomic removal of mut/var/assign
mut/var/assign removed from AILang entirely and atomically. Deleted: Term::Mut/Term::Assign/struct MutVar; the three Form-A keywords + parse_mut/parse_assign + grammar EBNF; the 4 mut CheckError variants; the mut_scope_stack synth threading (param dropped from synth + every internal/external/test caller); the two lower_term arms; and every exhaustive no-_ Term::Mut/Term::Assign match arm across 17 source files — cut in lockstep with DESIGN.md, fixtures, the drift trio, carve-out and roadmap so the schema is honest at every commit. No catch-all wildcard introduced (verified). loop/recur + let/if are the surviving forms. The shared codegen alloca machinery survives (loop reuses it): mut_var_allocas renamed binder_allocas (representation-only, loop codegen byte-identical) and the shared Term::Lam escape guard simplified to !loop_stack.is_empty() with the loop half (LoopBinderCapturedByLambda) byte-equivalent. Feature-acceptance applied inverted: the removed feature fails clause 2 (redundant) and clause 3 (IS the iterated-mutable-state bug class). Behaviour preservation is executable: mut_counter/mut_sum_floats still print 55 after the faithful let/if rewrite. The removal is made executable by the new mut_removed_pin.rs (4 must-fail pins). Independent verification: cargo test --workspace 605/0, zero residual mut symbols in any crate source, loop/recur non-regression all green (55 / 500000500000 / infinite-compiles / the lambda_capturing_loop_binder pin), roundtrip_cli PASS. One DONE_WITH_CONCERNS: a 4th recurrence of the recon-undercount class (in-source mod tests + a drift-pin fn + 5 orphaned mut .ail.json carve-outs + a non-enumerated E0599); all resolved within implementer remit, no behaviour change. Milestone-close audit then fieldtest remain. spec docs/specs/2026-05-18-remove-mut-var-assign.md (grounding PASS) plan docs/plans/remove-mut-var-assign.1.md
This commit is contained in:
@@ -187,48 +187,23 @@ fn check_ordering_match_post_migration_is_clean() {
|
||||
);
|
||||
}
|
||||
|
||||
/// Property (RED — fieldtest mut-local F2): in non-JSON (human) mode,
|
||||
/// the human-stderr formatter prepends the diagnostic code exactly once
|
||||
/// as the canonical `[code]` bracket prefix (the cli-diag-human format).
|
||||
/// The four mut-local `CheckError` variants
|
||||
/// (`mut-assign-out-of-scope`, `assign-type-mismatch`,
|
||||
/// `mut-var-unsupported-type`, `mut-var-captured-by-lambda`) must NOT
|
||||
/// also embed `[code] ` inside their `thiserror` Display body, which
|
||||
/// would render the bracketed code TWICE in the user-visible stderr
|
||||
/// line (`error: [code] fn: [code] message`).
|
||||
/// Property: in non-JSON (human) mode, the human-stderr formatter
|
||||
/// prepends the diagnostic code exactly once as the canonical
|
||||
/// `[code]` bracket prefix (the cli-diag-human format). The
|
||||
/// `loop-binder-captured-by-lambda` `CheckError` Display body must
|
||||
/// NOT also embed `[code] ` inside its `thiserror` Display body,
|
||||
/// which would render the bracketed code TWICE in the user-visible
|
||||
/// stderr line (`error: [code] fn: [code] message`).
|
||||
///
|
||||
/// This pins the *observable* doubling on the real CLI human path
|
||||
/// (`crates/ail/src/main.rs` non-JSON `Cmd::Check` arm), not the raw
|
||||
/// Display string of one variant in isolation: it counts occurrences
|
||||
/// of the literal `[<code>]` token in the rendered stderr and requires
|
||||
/// exactly one. Drops to GREEN once the four Display bodies shed their
|
||||
/// leading `[<code>] ` prefix (the formatter's prefix then supplies it
|
||||
/// once). The non-mut variants are unaffected because they never
|
||||
/// embedded the bracket.
|
||||
/// Display string of the variant in isolation: it counts occurrences
|
||||
/// of the literal `[<code>]` token in the rendered stderr and
|
||||
/// requires exactly one (the formatter supplies it; the Display body
|
||||
/// must not also embed it).
|
||||
#[test]
|
||||
fn check_human_mode_renders_mut_diagnostic_code_exactly_once() {
|
||||
// (fixture filename, kebab diagnostic code) for the four mut-local
|
||||
// negative fixtures shipped by the mut-local milestone.
|
||||
fn check_human_mode_renders_loop_binder_diagnostic_code_exactly_once() {
|
||||
let cases = [
|
||||
(
|
||||
"test_mut_assign_out_of_scope.ail.json",
|
||||
"mut-assign-out-of-scope",
|
||||
),
|
||||
(
|
||||
"test_mut_assign_type_mismatch.ail.json",
|
||||
"assign-type-mismatch",
|
||||
),
|
||||
(
|
||||
"test_mut_var_unsupported_type.ail.json",
|
||||
"mut-var-unsupported-type",
|
||||
),
|
||||
(
|
||||
"test_mut_var_captured_by_lambda.ail.json",
|
||||
"mut-var-captured-by-lambda",
|
||||
),
|
||||
// Iter loop-recur.tidy: symmetric loop-binder-capture variant.
|
||||
// Its Display body is likewise bracket-`[code]`-free so the
|
||||
// human formatter supplies `[<code>]` exactly once.
|
||||
(
|
||||
"test_loop_binder_captured_by_lambda.ail.json",
|
||||
"loop-binder-captured-by-lambda",
|
||||
|
||||
Reference in New Issue
Block a user