96db54d15d
Iteration-discipline milestone, 1 of 3. Adds named loop + recur as strictly-additive first-class AST nodes: parse/print/prose/serde/ round-trip/schema lockstep, typecheck (binder typing + recur arity/type unification via loop_stack threaded as mut.2's mut_scope_stack; recur-tail-position via verify_loop_body), codegen (loop-header + one phi per binder; recur back-edge br with a NEW parallel block_terminated setter; lambda-boundary loop_frames save/restore). Four Recur* CheckError variants. Strictly additive: zero deletions touch tail-app/tail-do or the seven existing block_terminated sites — this is what makes the destructive it.3 safe. recur synth = fresh metavar (resolves the plan's flagged Type::unit() risk). loop_counter->55, loop_in_lambda->49, four negatives fire, tail-app byte-identical, cargo test --workspace green. Specfda9b78, plan7381a42.
61 lines
1.7 KiB
JSON
61 lines
1.7 KiB
JSON
{
|
|
"schema": "ailang/v0",
|
|
"name": "test_recur_not_in_tail_position",
|
|
"imports": [],
|
|
"defs": [
|
|
{
|
|
"kind": "fn",
|
|
"name": "main",
|
|
"type": {
|
|
"k": "fn",
|
|
"params": [],
|
|
"ret": {
|
|
"k": "con",
|
|
"name": "Int"
|
|
},
|
|
"effects": []
|
|
},
|
|
"params": [],
|
|
"doc": "Iter it.1: recur in the lhs of a seq (non-tail) fires recur-not-in-tail-position.",
|
|
"body": {
|
|
"t": "loop",
|
|
"binders": [
|
|
{
|
|
"name": "i",
|
|
"type": {
|
|
"k": "con",
|
|
"name": "Int"
|
|
},
|
|
"init": {
|
|
"t": "lit",
|
|
"lit": {
|
|
"kind": "int",
|
|
"value": 0
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"body": {
|
|
"t": "seq",
|
|
"lhs": {
|
|
"t": "recur",
|
|
"args": [
|
|
{
|
|
"t": "var",
|
|
"name": "i"
|
|
}
|
|
]
|
|
},
|
|
"rhs": {
|
|
"t": "lit",
|
|
"lit": {
|
|
"kind": "int",
|
|
"value": 0
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|