mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 06:55:15 +00:00
Merge pull request #4399 from roc-lang/no-types-in-constraining-api
Have most constraining APIs take a type index rather than `Type`
This commit is contained in:
commit
02a76bb8bd
6 changed files with 485 additions and 366 deletions
|
@ -1323,40 +1323,29 @@ fn solve(
|
|||
region,
|
||||
} = includes_tag;
|
||||
|
||||
let typ_cell = &constraints.types[type_index.index()];
|
||||
let tys_cells = &constraints.types[types.indices()];
|
||||
let pattern_category = &constraints.pattern_categories[pattern_category.index()];
|
||||
|
||||
let actual = type_cell_to_var(
|
||||
let actual = either_type_index_to_var(
|
||||
constraints,
|
||||
subs,
|
||||
rank,
|
||||
pools,
|
||||
problems,
|
||||
abilities_store,
|
||||
obligation_cache,
|
||||
pools,
|
||||
aliases,
|
||||
typ_cell,
|
||||
*type_index,
|
||||
);
|
||||
|
||||
let tys = {
|
||||
let mut tys = Vec::with_capacity(tys_cells.len());
|
||||
for cell in tys_cells {
|
||||
let actual = type_cell_to_var(
|
||||
subs,
|
||||
rank,
|
||||
problems,
|
||||
abilities_store,
|
||||
obligation_cache,
|
||||
pools,
|
||||
aliases,
|
||||
cell,
|
||||
);
|
||||
tys.push(Type::Variable(actual));
|
||||
}
|
||||
tys
|
||||
};
|
||||
let payload_types = constraints.variables[types.indices()]
|
||||
.iter()
|
||||
.map(|v| Type::Variable(*v))
|
||||
.collect();
|
||||
|
||||
let tag_ty = Type::TagUnion(vec![(tag_name.clone(), tys)], TypeExtension::Closed);
|
||||
let tag_ty = Type::TagUnion(
|
||||
vec![(tag_name.clone(), payload_types)],
|
||||
TypeExtension::Closed,
|
||||
);
|
||||
let includes = type_to_var(
|
||||
subs,
|
||||
rank,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue