mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
remove aliases from solve Env
This commit is contained in:
parent
c18befeccf
commit
751ae125a5
3 changed files with 2 additions and 34 deletions
|
@ -23,7 +23,6 @@ pub fn run_solve(
|
|||
) -> (Solved<Subs>, solve::Env, Vec<solve::TypeError>) {
|
||||
let env = solve::Env {
|
||||
vars_by_symbol: MutMap::default(),
|
||||
aliases: MutMap::default(),
|
||||
};
|
||||
|
||||
let mut subs = Subs::new_from_varstore(var_store);
|
||||
|
@ -43,40 +42,11 @@ pub fn run_solve(
|
|||
}
|
||||
|
||||
pub fn make_solved_types(
|
||||
solved_env: &solve::Env,
|
||||
solved_subs: &Solved<Subs>,
|
||||
exposed_vars_by_symbol: &MutMap<Symbol, Variable>,
|
||||
) -> MutMap<Symbol, SolvedType> {
|
||||
let mut solved_types = MutMap::default();
|
||||
|
||||
for (symbol, alias) in solved_env.aliases.iter() {
|
||||
let mut args = Vec::with_capacity(alias.type_variables.len());
|
||||
|
||||
for loc_named_var in alias.type_variables.iter() {
|
||||
let (name, var) = &loc_named_var.value;
|
||||
|
||||
args.push((name.clone(), SolvedType::new(solved_subs, *var)));
|
||||
}
|
||||
|
||||
let mut lambda_set_variables = Vec::with_capacity(alias.lambda_set_variables.len());
|
||||
for set in alias.lambda_set_variables.iter() {
|
||||
lambda_set_variables.push(roc_types::solved_types::SolvedLambdaSet(
|
||||
SolvedType::from_type(solved_subs, &set.0),
|
||||
));
|
||||
}
|
||||
|
||||
let solved_type = SolvedType::from_type(solved_subs, &alias.typ);
|
||||
let solved_alias = SolvedType::Alias(
|
||||
*symbol,
|
||||
args,
|
||||
lambda_set_variables,
|
||||
Box::new(solved_type),
|
||||
alias.kind,
|
||||
);
|
||||
|
||||
solved_types.insert(*symbol, solved_alias);
|
||||
}
|
||||
|
||||
// exposed_vars_by_symbol contains the Variables for all the Symbols
|
||||
// this module exposes. We want to convert those into flat SolvedType
|
||||
// annotations which are decoupled from our Subs, because that's how
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue