29625e7262
The cma authoring-form harness corpus had gone dead against the language as it evolved since May. The plan modelled it as merely schema-dead (missing param_modes/ret_mode); it was also drift-dead in the example BODIES. Fixed in place, with `ail check` + both test suites as the oracle: - Schema: param_modes/ret_mode completed on every fn type; existing borrow annotations preserved (data_with_match's borrow over List). - Symbol drift: `<`/`==` -> `lt`/`eq` (operator-routing); the removed `io/print_int` op -> print_str(int_to_str n) followed by a newline print, preserving the trailing newline the references' expected_stdout needs. - Ownership/ADT restructures: data_simple's reuse-as now wraps the source in a match arm (ctor must be statically visible); data_with_match's count_via_letrec + local go switched borrow->own (consume-while-borrowed under the tightened ownership analysis; head_or_zero still exercises borrow over the boxed List). - param_modes_all rewritten to own (Int) + borrow over a boxed ADT -- (borrow Int) is now a borrow-over-value error. - Two new author-facing examples (loop_sum: Loop/Recur; new_rawbuf: New) cover the Term variants that landed since May. - spec_completeness.rs: drop the deleted ParamMode::Implicit; cover Loop/Recur/New; allowlist the non-authorable Term::Intrinsic out. - spec.md section 4 rewritten to own/borrow (mandatory, no implicit) with the borrow-over-value rule; rendered/ regenerated. - mock_full_run fixture's t3 turn-2 program migrated so the harness score assertions hold; usage fields untouched. Both render/ and harness/ cargo test suites green in mock mode; no live IONOS call. Run the harness budget/reference tests with AIL_BIN pointing at target/debug/ail (ail is not on PATH in the test env).
231 lines
4.8 KiB
JSON
231 lines
4.8 KiB
JSON
{
|
|
"schema": "ailang/v0",
|
|
"name": "data_with_match",
|
|
"imports": [],
|
|
"defs": [
|
|
{
|
|
"kind": "type",
|
|
"name": "List",
|
|
"doc": "Monomorphic singly-linked Int list \u2014 boxed, recursive.",
|
|
"ctors": [
|
|
{
|
|
"name": "Nil",
|
|
"fields": []
|
|
},
|
|
{
|
|
"name": "Cons",
|
|
"fields": [
|
|
{
|
|
"k": "con",
|
|
"name": "Int"
|
|
},
|
|
{
|
|
"k": "con",
|
|
"name": "List"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"kind": "fn",
|
|
"name": "head_or_zero",
|
|
"doc": "Return the head of xs, or 0 if empty. Exercises TermMatch with two arms, PatternCtor (both nullary Nil and binary Cons), and PatternWild on the tail field.",
|
|
"type": {
|
|
"k": "fn",
|
|
"params": [
|
|
{
|
|
"k": "con",
|
|
"name": "List"
|
|
}
|
|
],
|
|
"param_modes": [
|
|
"borrow"
|
|
],
|
|
"ret": {
|
|
"k": "con",
|
|
"name": "Int"
|
|
},
|
|
"ret_mode": "own",
|
|
"effects": []
|
|
},
|
|
"params": [
|
|
"xs"
|
|
],
|
|
"body": {
|
|
"t": "match",
|
|
"scrutinee": {
|
|
"t": "var",
|
|
"name": "xs"
|
|
},
|
|
"arms": [
|
|
{
|
|
"pat": {
|
|
"p": "ctor",
|
|
"ctor": "Nil",
|
|
"fields": []
|
|
},
|
|
"body": {
|
|
"t": "lit",
|
|
"lit": {
|
|
"kind": "int",
|
|
"value": 0
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"pat": {
|
|
"p": "ctor",
|
|
"ctor": "Cons",
|
|
"fields": [
|
|
{
|
|
"p": "var",
|
|
"name": "h"
|
|
},
|
|
{
|
|
"p": "wild"
|
|
}
|
|
]
|
|
},
|
|
"body": {
|
|
"t": "var",
|
|
"name": "h"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"kind": "fn",
|
|
"name": "count_via_letrec",
|
|
"doc": "Walk xs counting nodes using a local recursive let. Exercises TermLetRec and TermVar; the recursive `go` is bound locally.",
|
|
"type": {
|
|
"k": "fn",
|
|
"params": [
|
|
{
|
|
"k": "con",
|
|
"name": "List"
|
|
}
|
|
],
|
|
"param_modes": [
|
|
"own"
|
|
],
|
|
"ret": {
|
|
"k": "con",
|
|
"name": "Int"
|
|
},
|
|
"ret_mode": "own",
|
|
"effects": []
|
|
},
|
|
"params": [
|
|
"xs"
|
|
],
|
|
"body": {
|
|
"t": "letrec",
|
|
"name": "go",
|
|
"type": {
|
|
"k": "fn",
|
|
"params": [
|
|
{
|
|
"k": "con",
|
|
"name": "List"
|
|
}
|
|
],
|
|
"param_modes": [
|
|
"own"
|
|
],
|
|
"ret": {
|
|
"k": "con",
|
|
"name": "Int"
|
|
},
|
|
"ret_mode": "own",
|
|
"effects": []
|
|
},
|
|
"params": [
|
|
"ys"
|
|
],
|
|
"body": {
|
|
"t": "match",
|
|
"scrutinee": {
|
|
"t": "var",
|
|
"name": "ys"
|
|
},
|
|
"arms": [
|
|
{
|
|
"pat": {
|
|
"p": "ctor",
|
|
"ctor": "Nil",
|
|
"fields": []
|
|
},
|
|
"body": {
|
|
"t": "lit",
|
|
"lit": {
|
|
"kind": "int",
|
|
"value": 0
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"pat": {
|
|
"p": "ctor",
|
|
"ctor": "Cons",
|
|
"fields": [
|
|
{
|
|
"p": "wild"
|
|
},
|
|
{
|
|
"p": "var",
|
|
"name": "t"
|
|
}
|
|
]
|
|
},
|
|
"body": {
|
|
"t": "app",
|
|
"fn": {
|
|
"t": "var",
|
|
"name": "+"
|
|
},
|
|
"args": [
|
|
{
|
|
"t": "lit",
|
|
"lit": {
|
|
"kind": "int",
|
|
"value": 1
|
|
}
|
|
},
|
|
{
|
|
"t": "app",
|
|
"fn": {
|
|
"t": "var",
|
|
"name": "go"
|
|
},
|
|
"args": [
|
|
{
|
|
"t": "var",
|
|
"name": "t"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"in": {
|
|
"t": "app",
|
|
"fn": {
|
|
"t": "var",
|
|
"name": "go"
|
|
},
|
|
"args": [
|
|
{
|
|
"t": "var",
|
|
"name": "xs"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|