Coalesce inline and normal alias headers

Unifies `As` annotations and `Alias` defs to use a common struct for
defining alias header information, i.e. the name and type variables of
the alias.
This commit is contained in:
ayazhafiz 2021-12-26 09:37:35 -06:00
parent 597a1cef3b
commit 966198a6e7
11 changed files with 61 additions and 27 deletions

View file

@ -2,7 +2,7 @@ use crate::annotation::{Formattable, Newlines, Parens};
use crate::pattern::fmt_pattern;
use crate::spaces::{fmt_spaces, INDENT};
use crate::Buf;
use roc_parse::ast::{Def, Expr, Pattern};
use roc_parse::ast::{AliasHeader, Def, Expr, Pattern};
use roc_region::all::Loc;
/// A Located formattable value is also formattable
@ -55,7 +55,10 @@ impl<'a> Formattable for Def<'a> {
);
}
}
Alias { name, vars, ann } => {
Alias {
header: AliasHeader { name, vars },
ann,
} => {
buf.indent(indent);
buf.push_str(name.value);