Files
AILang/examples/test_22b1_orphan_third.ail.json
T
Brummel 057784934a iter 22b.1.3: registry coherence-check fixtures + tests
Adds seven fixtures under examples/test_22b1_* exercising the
workspace-load coherence checks plus four positive/negative tests in
ailang-core/src/workspace.rs:

- iter22b1_instance_in_class_module_loads_clean: positive case;
  test_22b1_orphan_class.ail.json declares Show + instance Show Int
  in the same module (the class's). Registry has one entry.
- iter22b1_orphan_instance_fires_diagnostic: declares Show in
  test_22b1_orphan_third_classmod, declares instance Show Int in
  test_22b1_orphan_third (a third module). Fires OrphanInstance.
- iter22b1_duplicate_instance_fires_diagnostic: per the JOURNAL hint,
  module A defines class Show + instance Show MyInt (legal, A is
  class's module), module B defines type MyInt + instance Show MyInt
  (legal, B is type's module). Entry imports both. Fires
  DuplicateInstance with first/second_module distinct.
- iter22b1_missing_method_fires_diagnostic: class Eq with two
  non-default methods (eq, ne), instance Eq Int specifies only ne.
  Fires MissingMethod { method: "eq" }.

The surface round-trip gate (ailang-surface/tests/round_trip.rs)
filters out test_22b1_* fixtures because the Form-B parser arms for
ClassDef/InstanceDef are deferred to 22b.4. Without the filter, every
fixture's printed text would re-parse-fail on the unknown `class` /
`instance` head.

Test count: 291 → 295 (4 new workspace tests, all green).
2026-05-09 12:40:06 +02:00

21 lines
409 B
JSON

{
"schema": "ailang/v0",
"name": "test_22b1_orphan_third",
"imports": [
{ "module": "test_22b1_orphan_third_classmod" }
],
"defs": [
{
"kind": "instance",
"class": "Show",
"type": { "k": "con", "name": "Int" },
"methods": [
{
"name": "show",
"body": { "t": "lit", "lit": { "kind": "str", "value": "<int>" } }
}
]
}
]
}