From 04448040d989e10565f311b42e5b18803f71d4d3 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sun, 3 May 2026 00:08:49 +0100 Subject: [PATCH] fix(test): remove trailing semicolons in test_opt_if_fold if-branches `tests/codegen/test_opt_if_fold.affine` had `if true { 42; } else { 0; }` where the trailing `;` makes each branch return Unit. The recent typechecker work (in lib/typecheck.ml on this branch) tightened unification so this now produces: Unification error: (Unify.TypeMismatch (Unit, Int)) affinescript: Type error Removed the trailing semicolons inside the if-branches; bare expressions now return Int and `let x = if ...` typechecks. Added a comment documenting the gotcha for future test authors. Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> Co-Authored-By: Claude Opus 4.7 (1M context) Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> --- tests/codegen/test_opt_if_fold.affine | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/codegen/test_opt_if_fold.affine b/tests/codegen/test_opt_if_fold.affine index 8bdd62f..b6756e8 100644 --- a/tests/codegen/test_opt_if_fold.affine +++ b/tests/codegen/test_opt_if_fold.affine @@ -1,7 +1,11 @@ // Test if-expression constant folding fn main() -> Int { - let x = if true { 42; } else { 0; }; // Should fold to 42 - let y = if false { 99; } else { 10; }; // Should fold to 10 + // No trailing semicolons inside the if-branches: a trailing `;` makes + // the branch return Unit, so `let x = if ...` would fail with + // "Unification error: (Unify.TypeMismatch (Unit, Int))". The bare + // expression form returns Int. + let x = if true { 42 } else { 0 }; // Should fold to 42 + let y = if false { 99 } else { 10 }; // Should fold to 10 return x + y; // 42 + 10 = 52 }