From 27efb60b26acdde53fc97e3414f5ee3835fad89d Mon Sep 17 00:00:00 2001 From: Matthieu Pizenberg Date: Thu, 4 Dec 2025 18:55:50 +0100 Subject: [PATCH] Reference the new platform test Signed-off-by: Matthieu Pizenberg --- src/cli/test/fx_platform_test.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cli/test/fx_platform_test.zig b/src/cli/test/fx_platform_test.zig index bc4cf8274b..980cf7ee4d 100644 --- a/src/cli/test/fx_platform_test.zig +++ b/src/cli/test/fx_platform_test.zig @@ -1538,3 +1538,16 @@ test "fx platform method inspect on string" { // Should show MISSING METHOD error try testing.expect(std.mem.indexOf(u8, run_result.stderr, "MISSING METHOD") != null); } + +test "fx platform if-expression closure capture regression" { + // Regression test: Variables bound inside an if-expression's block were + // incorrectly being captured as free variables by the enclosing lambda, + // causing a crash with "e_closure: failed to resolve capture value". + const allocator = testing.allocator; + + const run_result = try runRoc(allocator, "test/fx/if-closure-capture.roc", .{}); + defer allocator.free(run_result.stdout); + defer allocator.free(run_result.stderr); + + try checkSuccess(run_result); +}