restructure how def_types are stored in Constraints

This commit is contained in:
Folkert 2022-03-05 21:47:49 +01:00
parent 6392e42166
commit c7c9a90d65
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 31 additions and 27 deletions

View file

@ -3,7 +3,6 @@ use roc_can::constraint::Constraint::{self, *};
use roc_can::constraint::{Constraints, LetConstraint};
use roc_can::expected::{Expected, PExpected};
use roc_collections::all::MutMap;
use roc_collections::soa::{Index, Slice};
use roc_module::ident::TagName;
use roc_module::symbol::Symbol;
use roc_region::all::{Loc, Region};
@ -819,23 +818,17 @@ impl LocalDefVarsVec<(Symbol, Loc<Variable>)> {
pools: &mut Pools,
cached_aliases: &mut MutMap<Symbol, Variable>,
subs: &mut Subs,
def_types_slice: Slice<(Symbol, Loc<Index<Type>>)>,
def_types_slice: roc_can::constraint::DefTypes,
) -> Self {
let def_types = &constraints.def_types[def_types_slice.indices()];
let types_slice = &constraints.types[def_types_slice.types.indices()];
let loc_symbols_slice = &constraints.loc_symbols[def_types_slice.loc_symbols.indices()];
let mut local_def_vars = Self::with_length(def_types.len());
let mut local_def_vars = Self::with_length(types_slice.len());
for (symbol, loc_type_index) in def_types.iter() {
let typ = &constraints.types[loc_type_index.value.index()];
for ((symbol, region), typ) in loc_symbols_slice.iter().copied().zip(types_slice) {
let var = type_to_var(subs, rank, pools, cached_aliases, typ);
local_def_vars.push((
*symbol,
Loc {
value: var,
region: loc_type_index.region,
},
));
local_def_vars.push((symbol, Loc { value: var, region }));
}
local_def_vars