{ "schema": "ailang/v0", "name": "test_mut_var_captured_by_lambda", "imports": [], "defs": [ { "kind": "fn", "name": "main", "type": { "k": "fn", "params": [], "ret": { "k": "con", "name": "Int" }, "effects": [] }, "params": [], "doc": "Iter mut.4-tidy: a lambda inside a mut block that references the enclosing mut-var `x` is rejected with mut-var-captured-by-lambda. Mut-vars are alloca-resident and lexically scoped; lifting them into a heap-closure env is deferred to a follow-on milestone (ref-types + !Mut effect).", "body": { "t": "mut", "vars": [ { "name": "x", "type": { "k": "con", "name": "Int" }, "init": { "t": "lit", "lit": { "kind": "int", "value": 0 } } } ], "body": { "t": "let", "name": "f", "value": { "t": "lam", "params": [], "paramTypes": [], "retType": { "k": "con", "name": "Int" }, "effects": [], "body": { "t": "var", "name": "x" } }, "body": { "t": "lit", "lit": { "kind": "int", "value": 0 } } } } } ] }