iter 22b.2.1: add Constraint struct, Type::Forall.constraints

This commit is contained in:
2026-05-09 17:34:39 +02:00
parent e1d748d64e
commit b636b883a3
14 changed files with 94 additions and 20 deletions
+4 -2
View File
@@ -191,8 +191,9 @@ pub(crate) fn qualify_local_types_codegen(
param_modes: vec![],
ret_mode: ParamMode::Implicit,
},
Type::Forall { vars, body } => Type::Forall {
Type::Forall { vars, constraints, body } => Type::Forall {
vars: vars.clone(),
constraints: constraints.clone(),
body: Box::new(qualify_local_types_codegen(body, owner_module, owner_local_types)),
},
Type::Var { .. } => t.clone(),
@@ -216,7 +217,7 @@ pub(crate) fn apply_subst_to_type(t: &Type, subst: &BTreeMap<String, Type>) -> T
param_modes: vec![],
ret_mode: ParamMode::Implicit,
},
Type::Forall { vars, body } => {
Type::Forall { vars, constraints, body } => {
// Inner forall shadows: don't substitute re-bound names.
let inner: BTreeMap<String, Type> = subst
.iter()
@@ -225,6 +226,7 @@ pub(crate) fn apply_subst_to_type(t: &Type, subst: &BTreeMap<String, Type>) -> T
.collect();
Type::Forall {
vars: vars.clone(),
constraints: constraints.clone(),
body: Box::new(apply_subst_to_type(body, &inner)),
}
}