057784934a
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).
37 lines
724 B
JSON
37 lines
724 B
JSON
{
|
|
"schema": "ailang/v0",
|
|
"name": "test_22b1_dup_a",
|
|
"imports": [
|
|
{ "module": "test_22b1_dup_b" }
|
|
],
|
|
"defs": [
|
|
{
|
|
"kind": "class",
|
|
"name": "Show",
|
|
"param": "a",
|
|
"methods": [
|
|
{
|
|
"name": "show",
|
|
"type": {
|
|
"k": "fn",
|
|
"params": [{ "k": "var", "name": "a" }],
|
|
"ret": { "k": "con", "name": "Str" },
|
|
"effects": []
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"kind": "instance",
|
|
"class": "Show",
|
|
"type": { "k": "con", "name": "MyInt" },
|
|
"methods": [
|
|
{
|
|
"name": "show",
|
|
"body": { "t": "lit", "lit": { "kind": "str", "value": "from-a" } }
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|