iter ct.1.5a-followup: forall-constraints recursion + docstring + drop iteration-tag comments

Three Minor items from the ct.1.5a quality review:

1. normalize_type_for_registry now recurses into
   Type::Forall.constraints[].type_, symmetric to walk_type. Closes a
   latent gap: a Forall with bare cross-module constraint types reaching
   the registry would have produced a key disagreeing with the qualified
   form. RED test: ct1_5a_normalize_recurses_into_forall_constraints.

2. Documented the bare-name limitation on Registry::type_def_module:
   two modules each defining 'type Foo' collide at insert; the proper
   fix (re-key as (owning_module, bare_name)) is out of ct.1's scope.

3. Removed the four iter-tag explanatory paragraphs at the
   normalize_type_for_lookup call sites (check/lib.rs check_fn,
   mono.rs three sites). Replaced each with a one-line pointer to the
   helper's docstring per project comment policy.
This commit is contained in:
2026-05-11 01:39:26 +02:00
parent 7872ccfc23
commit 5e653ff536
3 changed files with 76 additions and 18 deletions
+1 -5
View File
@@ -1538,11 +1538,7 @@ fn check_fn(f: &FnDef, env: &Env) -> Result<()> {
// → no-instance. The hash uses `canonical::type_hash`, the
// same key shape `workspace::build_registry` writes with, so
// representation-equal types match deterministically.
// ct.1.5a: route `r_ty` through
// `Registry::normalize_type_for_lookup` so a bare
// `Type::Con` produced for an instance whose head-type lives
// in another module rewrites to the qualified form the
// registry actually keyed on.
// normalize to match Registry::normalize_type_for_lookup contract
let r_ty_norm = env.workspace_registry.normalize_type_for_lookup(&r_ty);
let key = (
r.class.clone(),
+3 -12
View File
@@ -115,12 +115,7 @@ pub fn monomorphise_workspace(ws: &Workspace) -> Result<Workspace> {
// never mutates the registry.
for t in &new {
let key = mono_target_key(t);
// ct.1.5a: route `t.type_` through
// `Registry::normalize_type_for_lookup` so a bare
// `Type::Con` produced for an instance whose head-type lives
// in another module rewrites to the qualified form the
// registry actually keyed on. Symmetric to the
// `collect_targets_*` lookups above.
// normalize to match Registry::normalize_type_for_lookup contract
let t_ty_norm = ws_owned.registry.normalize_type_for_lookup(&t.type_);
let registry_key =
(t.class.clone(), ailang_core::canonical::type_hash(&t_ty_norm));
@@ -521,9 +516,7 @@ pub fn collect_mono_targets(
if !crate::is_fully_concrete(&r_ty) {
continue;
}
// ct.1.5a: normalise `r_ty` to its always-qualified canonical
// form before hashing — symmetric to the write side in
// `workspace::build_registry`.
// normalize to match Registry::normalize_type_for_lookup contract
let r_ty_norm = env.workspace_registry.normalize_type_for_lookup(&r_ty);
let key = (r.class.clone(), ailang_core::canonical::type_hash(&r_ty_norm));
let entry = match env.workspace_registry.entries.get(&key) {
@@ -879,9 +872,7 @@ pub(crate) fn collect_residuals_ordered(
out.push(None);
continue;
}
// ct.1.5a: normalise `r_ty` to its always-qualified canonical
// form before hashing — symmetric to the write side in
// `workspace::build_registry`.
// normalize to match Registry::normalize_type_for_lookup contract
let r_ty_norm = env.workspace_registry.normalize_type_for_lookup(&r_ty);
let key = (r.class.clone(), ailang_core::canonical::type_hash(&r_ty_norm));
let entry = match env.workspace_registry.entries.get(&key) {