mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Parse destructured tag annotations as annotations rather than aliases
Closes #178
This commit is contained in:
parent
fe62e59e31
commit
b3ddfa7515
8 changed files with 192 additions and 34 deletions
|
@ -265,6 +265,17 @@ pub enum Def<'a> {
|
|||
NotYetImplemented(&'static str),
|
||||
}
|
||||
|
||||
impl<'a> Def<'a> {
|
||||
pub fn unroll_spaces_before(&self) -> (&'a [CommentOrNewline<'a>], &Def) {
|
||||
let (spaces, def): (&'a [_], &Def) = match self {
|
||||
Def::SpaceBefore(def, spaces) => (spaces, def),
|
||||
def => (&[], def),
|
||||
};
|
||||
debug_assert!(!matches!(def, Def::SpaceBefore(_, _)));
|
||||
(spaces, def)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
pub enum TypeAnnotation<'a> {
|
||||
/// A function. The types of its arguments, then the type of its return value.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue