mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Merge pull request #2276 from rtfeldman/i/2265
Parse "as" aliases into tag/args rather than arbitrary annotations
This commit is contained in:
commit
bb935948aa
16 changed files with 506 additions and 284 deletions
|
@ -225,6 +225,12 @@ pub struct PrecedenceConflict<'a> {
|
|||
pub expr: &'a Loc<Expr<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct AliasHeader<'a> {
|
||||
pub name: Loc<&'a str>,
|
||||
pub vars: &'a [Loc<Pattern<'a>>],
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Def<'a> {
|
||||
// TODO in canonicalization, validate the pattern; only certain patterns
|
||||
|
@ -236,8 +242,7 @@ pub enum Def<'a> {
|
|||
///
|
||||
/// Foo : Bar Baz
|
||||
Alias {
|
||||
name: Loc<&'a str>,
|
||||
vars: &'a [Loc<Pattern<'a>>],
|
||||
header: AliasHeader<'a>,
|
||||
ann: Loc<TypeAnnotation<'a>>,
|
||||
},
|
||||
|
||||
|
@ -291,7 +296,7 @@ pub enum TypeAnnotation<'a> {
|
|||
As(
|
||||
&'a Loc<TypeAnnotation<'a>>,
|
||||
&'a [CommentOrNewline<'a>],
|
||||
&'a Loc<TypeAnnotation<'a>>,
|
||||
AliasHeader<'a>,
|
||||
),
|
||||
|
||||
Record {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue