Files
AILang/examples/test_22b3_xmod_e2e_classmod.ail.json
T
Brummel 090f082215 iter 22b.3.tester: e2e for coherence, default-keyword, cross-module mono
Adds three end-to-end tests for the 22b.3 mono pass, each with a
matching one-property fixture under examples/. Defends mono-pass
invariants 3, 4, and 6 from docs/specs/2026-05-09-22-typeclasses.md
at the binary level (stdout-asserting, not AST-asserting):

- coherence_two_instances_pick_correct_body_at_runtime — class R
  with instances at Int and Bool, both reachable from one main.
  Stdout `11\n22` proves both mono fns are synthesised AND each
  call site picks the matching body (no collapse).

- class_default_method_runs_and_prints_default_value — empty
  instance body + class-level `default` clause must lower, link,
  and print the default value (`99`). Promotes the existing
  synthesise_mono_fn unit test to a binary-level guarantee.

- cross_module_class_method_runs_and_prints_correct_value —
  class+instance in module A, called from module B's main. The
  qualified-name rewrite + cross-module synth-def placement was
  AST-tested in 22b.3.6; this pins down the emit-and-link path.

All 18 typeclass_22b3 tests pass; full workspace green; 3 bench
gates 0/0/0.
2026-05-09 21:36:15 +02:00

33 lines
780 B
JSON

{
"schema": "ailang/v0",
"name": "test_22b3_xmod_e2e_classmod",
"imports": [],
"defs": [
{
"kind": "class", "name": "XR", "param": "a",
"methods": [{
"name": "xr",
"type": {
"k": "fn", "params": [{ "k": "var", "name": "a" }],
"ret": { "k": "con", "name": "Int" }, "effects": []
}
}]
},
{
"kind": "instance",
"class": "XR",
"type": { "k": "con", "name": "Int" },
"methods": [{
"name": "xr",
"body": {
"t": "lam",
"params": ["x"],
"paramTypes": [{ "k": "var", "name": "a" }],
"retType": { "k": "con", "name": "Int" },
"body": { "t": "lit", "lit": { "kind": "int", "value": 7 } }
}
}]
}
]
}