mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +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
|
@ -182,6 +182,14 @@ fn index_var(
|
|||
|
||||
return Ok(field_types);
|
||||
}
|
||||
FlatType::Tuple(elems, ext) => {
|
||||
let elem_types = elems
|
||||
.sorted_iterator(subs, *ext)
|
||||
.map(|(_, elem)| elem)
|
||||
.collect();
|
||||
|
||||
return Ok(elem_types);
|
||||
}
|
||||
FlatType::TagUnion(tags, ext) | FlatType::RecursiveTagUnion(_, tags, ext) => {
|
||||
let tag_ctor = match ctor {
|
||||
IndexCtor::Tag(name) => name,
|
||||
|
@ -213,6 +221,9 @@ fn index_var(
|
|||
};
|
||||
return Ok(std::iter::repeat(Variable::NULL).take(num_fields).collect());
|
||||
}
|
||||
FlatType::EmptyTuple => {
|
||||
return Ok(std::iter::repeat(Variable::NULL).take(0).collect());
|
||||
}
|
||||
FlatType::EmptyTagUnion => {
|
||||
internal_error!("empty tag unions are not indexable")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue