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
+3 -2
View File
@@ -259,7 +259,7 @@ fn write_fn_def(out: &mut String, fd: &FnDef, level: usize) {
// we render the forall on the line above and then the inner fn
// signature.
let (forall_vars, fn_ty) = match &fd.ty {
Type::Forall { vars, body } => (Some(vars.clone()), body.as_ref()),
Type::Forall { vars, constraints: _, body } => (Some(vars.clone()), body.as_ref()),
other => (None, other),
};
@@ -405,7 +405,7 @@ fn write_type(out: &mut String, t: &Type) {
}
}
}
Type::Forall { vars, body } => {
Type::Forall { vars, constraints: _, body } => {
out.push_str("forall<");
for (i, v) in vars.iter().enumerate() {
if i > 0 {
@@ -1445,6 +1445,7 @@ mod tests {
fn type_forall_renders_with_angle_vars() {
let t = Type::Forall {
vars: vec!["a".into()],
constraints: vec![],
body: Box::new(Type::Var { name: "a".into() }),
};
assert_eq!(render_type(&t), "forall<a> a");