mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Initial implementation of tuples in type checking
This leaves in place a bunch of TODOs and likely many bugs - notably, I haven't tested codegen/layout at all here.
This commit is contained in:
parent
d57cb50425
commit
de828416bf
32 changed files with 1785 additions and 112 deletions
|
@ -306,17 +306,37 @@ fn expr<'a>(c: &Ctx, p: EPrec, f: &'a Arena<'a>, e: &'a Expr) -> DocBuilder<'a,
|
|||
.append(f.line())
|
||||
.append(f.text("}"))
|
||||
.group(),
|
||||
Tuple { elems, .. } => f
|
||||
.reflow("(")
|
||||
.append(
|
||||
f.intersperse(
|
||||
elems.iter().map(|(_var, elem)| {
|
||||
f.line()
|
||||
.append(expr(c, Free, f, &elem.value))
|
||||
.nest(2)
|
||||
.group()
|
||||
}),
|
||||
f.reflow(","),
|
||||
)
|
||||
.nest(2)
|
||||
.group(),
|
||||
)
|
||||
.append(f.line())
|
||||
.append(f.text(")"))
|
||||
.group(),
|
||||
EmptyRecord => f.text("{}"),
|
||||
Access {
|
||||
RecordAccess {
|
||||
loc_expr, field, ..
|
||||
} => expr(c, AppArg, f, &loc_expr.value)
|
||||
.append(f.text(format!(".{}", field.as_str())))
|
||||
.group(),
|
||||
TupleAccess { .. } => todo!(),
|
||||
OpaqueWrapFunction(OpaqueWrapFunctionData { opaque_name, .. }) => {
|
||||
f.text(format!("@{}", opaque_name.as_str(c.interns)))
|
||||
}
|
||||
Accessor(_) => todo!(),
|
||||
Update {
|
||||
RecordAccessor(_) => todo!(),
|
||||
TupleAccessor(_) => todo!(),
|
||||
RecordUpdate {
|
||||
symbol, updates, ..
|
||||
} => f
|
||||
.reflow("{")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue