feat: unify tuples and stdlib updates

This commit is contained in:
rvcas
2022-12-06 22:01:12 -05:00
committed by Lucas
parent 3f47a1f4b8
commit 45990f1f84
4 changed files with 111 additions and 9 deletions

View File

@@ -856,9 +856,17 @@ impl<'comments> Formatter<'comments> {
match args {
[arg] if is_breakable_expr(&arg.value) => self
.expr(fun)
.append(if needs_curly { "{" } else { "(" })
.append(if needs_curly {
break_(" {", " { ")
} else {
break_("(", "(")
})
.append(self.call_arg(arg, needs_curly))
.append(if needs_curly { "}" } else { ")" })
.append(if needs_curly {
break_("}", " }")
} else {
break_(")", ")")
})
.group(),
_ => self

View File

@@ -1200,6 +1200,19 @@ impl<'a> Environment<'a> {
Ok(())
}
(Type::Tuple { elems: elems1, .. }, Type::Tuple { elems: elems2, .. })
if elems1.len() == elems2.len() =>
{
for (a, b) in elems1.iter().zip(elems2) {
unify_enclosed_type(
t1.clone(),
t2.clone(),
self.unify(a.clone(), b.clone(), location),
)?;
}
Ok(())
}
(
Type::Fn {
args: args1,