From 0a80bfc5668f174d18c7145b24e6d9355e3c7dcc Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sun, 17 May 2026 15:44:11 +0100 Subject: [PATCH] fix(stdlib): rename `total` var -> `tot` (#135 slice 4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #135 slice 4 — the triage hypothesised a block/statement LR ambiguity for testing.affine:302 / math.affine:354. Precise isolation disproved that: every minimal block/stmt shape parses. The real cause is keyword-as-identifier (slice-6 class): `total` is the `TOTAL` reserved keyword (totality marker, `total fn`), so `let total = …` fails to parse. `let total = 0.0; …` fails; `let tot = 0.0; …` parses. Rename the `total` *variable* -> `tot` in math.affine `mean`/ `sum_float` (also `let mut`, they reassign in a loop) and testing.affine `bench`. The `total_time` record field is a different identifier (`total` only when bare) and is left unchanged; string-literal "total" text untouched. Pure stdlib rename — zero grammar/compiler risk. Effect: math.affine PARSE 354 -> RESOLVE; testing.affine PARSE 302 -> TYPECHECK (both clear the parse wall, advance to distinct deeper defects). traits.affine:124 is unrelated (`while let` pattern binding) — a genuine separate construct, still tracked. Suite unaffected (stdlib-only). Advances #135. Refs #128, #135. Co-Authored-By: Claude Opus 4.7 (1M context) --- stdlib/math.affine | 12 ++++++------ stdlib/testing.affine | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stdlib/math.affine b/stdlib/math.affine index 24270f0c..d3b65c55 100644 --- a/stdlib/math.affine +++ b/stdlib/math.affine @@ -351,18 +351,18 @@ fn mean(values: [Float]) -> Float { if n == 0 { return 0.0; } - let total = 0.0; + let mut tot = 0.0; for v in values { - total = total + v; + tot = tot + v; } - total / to_float(n) + tot / to_float(n) } /// Sum of a list of floats fn sum_float(values: [Float]) -> Float { - let total = 0.0; + let mut tot = 0.0; for v in values { - total = total + v; + tot = tot + v; } - total + tot } diff --git a/stdlib/testing.affine b/stdlib/testing.affine index daecd88f..14b00759 100644 --- a/stdlib/testing.affine +++ b/stdlib/testing.affine @@ -299,11 +299,11 @@ fn bench(f: () -> (), iterations: Int) -> BenchResult { i = i + 1; } - let total = time_now() - start; + let tot = time_now() - start; { iterations: iterations, - total_time: total, - avg_time: total / (iterations + 0.0) + total_time: tot, + avg_time: tot / (iterations + 0.0) } }