iter 22b.2.1: add Constraint struct, Type::Forall.constraints
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user