iter 22b.1.1: ClassDef/InstanceDef AST + downstream match arms
Adds Def::Class(ClassDef) and Def::Instance(InstanceDef) variants per Decision 11 §"Form-A schema". All optional fields (superclass, doc, default body) carry skip_serializing_if so canonical-JSON bytes of pre-22b fixtures stay bit-identical. Downstream match-on-Def sites are extended with explicit Class/Instance arms. Behaviour for 22b.1 is placeholder (skip in typecheck/codegen, one-line summary in pretty/manifest, placeholder marker in prose/print) with TODO comments naming the deferred sub-iters (22b.2 typecheck, 22b.3 codegen, 22b.4 prose-projection arms).
This commit is contained in:
@@ -1007,6 +1007,14 @@ fn collect_refs(def: &ailang_core::Def) -> std::collections::BTreeSet<String> {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Iter 22b.1: `ail deps` does not yet trace references inside
|
||||
// class/instance defs. Walking method signatures and bodies
|
||||
// (default bodies, instance method bodies) lands in 22b.2 along
|
||||
// with the typecheck arms — until then a class/instance def
|
||||
// contributes no entries to the dependency graph. Tools that
|
||||
// call `collect_refs` (`ail deps`, the cross-module-fan-out
|
||||
// diagnostics) therefore treat them as leaves.
|
||||
ailang_core::Def::Class(_) | ailang_core::Def::Instance(_) => {}
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -1416,6 +1424,25 @@ fn def_summary(d: &ailang_core::Def) -> (&'static str, String, Vec<String>) {
|
||||
.join(" | ");
|
||||
("type", s, vec![])
|
||||
}
|
||||
// Iter 22b.1: a one-line `class C a` / `instance C T` summary
|
||||
// for `ail manifest`. The `effects` slot is empty for both —
|
||||
// class methods carry their own effect annotations on each
|
||||
// method signature, but the class itself does not (it is a
|
||||
// collection of method signatures, not a single function).
|
||||
ailang_core::Def::Class(c) => (
|
||||
"class",
|
||||
format!("{} {}", c.name, c.param),
|
||||
vec![],
|
||||
),
|
||||
ailang_core::Def::Instance(i) => (
|
||||
"instance",
|
||||
format!(
|
||||
"{} {}",
|
||||
i.class,
|
||||
ailang_core::pretty::type_to_string(&i.type_)
|
||||
),
|
||||
vec![],
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user