// Closure literal declared (and used) inside a `defer` body. // // Regression (issue 0073): this used to segfault lowering. A lambda inherited // the enclosing function's `func_defer_base`, so the lambda's `return` re-drained // the enclosing function's defers — and when the defer body itself declared the // lambda, that re-lowered the lambda forever (infinite recursion). A lambda now // opens its own defer window (like every other function-lowering entry). #import "modules/std.sx"; run :: () { defer { cb := (n: s32) -> s32 { return n * 2; }; print("defer closure: {}\n", cb(21)); // 42, at scope exit } print("body\n"); } main :: () -> s32 { run(); return 0; }