mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
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:
parent
597a1cef3b
commit
966198a6e7
11 changed files with 61 additions and 27 deletions
|
@ -1,6 +1,6 @@
|
|||
use crate::ast::{
|
||||
AssignedField, Collection, CommentOrNewline, Def, Expr, ExtractSpaces, Pattern, Spaceable,
|
||||
TypeAnnotation,
|
||||
AliasHeader, AssignedField, Collection, CommentOrNewline, Def, Expr, ExtractSpaces, Pattern,
|
||||
Spaceable, TypeAnnotation,
|
||||
};
|
||||
use crate::blankspace::{space0_after_e, space0_around_ee, space0_before_e, space0_e};
|
||||
use crate::ident::{lowercase_ident, parse_ident, Ident};
|
||||
|
@ -744,8 +744,10 @@ fn append_alias_definition<'a>(
|
|||
loc_ann: Loc<TypeAnnotation<'a>>,
|
||||
) {
|
||||
let def = Def::Alias {
|
||||
name,
|
||||
vars: pattern_arguments,
|
||||
header: AliasHeader {
|
||||
name,
|
||||
vars: pattern_arguments,
|
||||
},
|
||||
ann: loc_ann,
|
||||
};
|
||||
let mut loc_def = Loc::at(region, def);
|
||||
|
@ -1096,8 +1098,10 @@ fn parse_expr_operator<'a>(
|
|||
let alias_region = Region::span_across(&expr.region, &ann_type.region);
|
||||
|
||||
let alias = Def::Alias {
|
||||
name: Loc::at(expr.region, name),
|
||||
vars: type_arguments.into_bump_slice(),
|
||||
header: AliasHeader {
|
||||
name: Loc::at(expr.region, name),
|
||||
vars: type_arguments.into_bump_slice(),
|
||||
},
|
||||
ann: ann_type,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue