Fix a bunch of bugs in parsing/formatting found by fuzzing

This commit is contained in:
Joshua Warner 2023-02-05 11:48:05 -08:00
parent acd446f6bd
commit 3fee0d3e8f
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
43 changed files with 593 additions and 70 deletions

View file

@ -76,8 +76,19 @@ impl<'a> Formattable for TypeDef<'a> {
for var in *vars {
buf.spaces(1);
let need_parens = matches!(var.value, Pattern::Apply(..));
if need_parens {
buf.push_str("(");
}
fmt_pattern(buf, &var.value, indent, Parens::NotNeeded);
buf.indent(indent);
if need_parens {
buf.push_str(")");
}
}
buf.push_str(" :");