mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
implement mono / lowering for tuples
This commit is contained in:
parent
65f8bb3d0d
commit
5a6be05ead
42 changed files with 1773 additions and 290 deletions
|
@ -1,6 +1,7 @@
|
|||
use std::fmt::Debug;
|
||||
|
||||
use crate::header::{AppHeader, HostedHeader, InterfaceHeader, PackageHeader, PlatformHeader};
|
||||
use crate::ident::Accessor;
|
||||
use crate::parser::ESingleQuote;
|
||||
use bumpalo::collections::{String, Vec};
|
||||
use bumpalo::Bump;
|
||||
|
@ -243,13 +244,12 @@ pub enum Expr<'a> {
|
|||
|
||||
/// Look up exactly one field on a record, e.g. `x.foo`.
|
||||
RecordAccess(&'a Expr<'a>, &'a str),
|
||||
/// e.g. `.foo`
|
||||
RecordAccessorFunction(&'a str),
|
||||
|
||||
/// e.g. `.foo` or `.0`
|
||||
AccessorFunction(Accessor<'a>),
|
||||
|
||||
/// Look up exactly one field on a tuple, e.g. `(x, y).1`.
|
||||
TupleAccess(&'a Expr<'a>, &'a str),
|
||||
/// e.g. `.1`
|
||||
TupleAccessorFunction(&'a str),
|
||||
|
||||
// Collection Literals
|
||||
List(Collection<'a, &'a Loc<Expr<'a>>>),
|
||||
|
@ -612,7 +612,7 @@ pub enum TypeAnnotation<'a> {
|
|||
},
|
||||
|
||||
Tuple {
|
||||
fields: Collection<'a, Loc<TypeAnnotation<'a>>>,
|
||||
elems: Collection<'a, Loc<TypeAnnotation<'a>>>,
|
||||
/// The row type variable in an open tuple, e.g. the `r` in `( Str, Str )r`.
|
||||
/// This is None if it's a closed tuple annotation like `( Str, Str )`.
|
||||
ext: Option<&'a Loc<TypeAnnotation<'a>>>,
|
||||
|
@ -1459,8 +1459,7 @@ impl<'a> Malformed for Expr<'a> {
|
|||
Float(_) |
|
||||
Num(_) |
|
||||
NonBase10Int { .. } |
|
||||
TupleAccessorFunction(_) |
|
||||
RecordAccessorFunction(_) |
|
||||
AccessorFunction(_) |
|
||||
Var { .. } |
|
||||
Underscore(_) |
|
||||
Tag(_) |
|
||||
|
@ -1729,7 +1728,7 @@ impl<'a> Malformed for TypeAnnotation<'a> {
|
|||
fields.iter().any(|field| field.is_malformed())
|
||||
|| ext.map(|ext| ext.is_malformed()).unwrap_or_default()
|
||||
}
|
||||
TypeAnnotation::Tuple { fields, ext } => {
|
||||
TypeAnnotation::Tuple { elems: fields, ext } => {
|
||||
fields.iter().any(|field| field.is_malformed())
|
||||
|| ext.map(|ext| ext.is_malformed()).unwrap_or_default()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue