the debugging begins

This commit is contained in:
Folkert 2022-03-02 20:30:42 +01:00
parent 73bd647a7d
commit c52029c2d1
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
6 changed files with 158 additions and 13 deletions

View file

@ -1,5 +1,6 @@
use crate::solve;
use roc_can::constraint::Constraint;
use roc_can::constraint_soa::{Constraint as ConstraintSoa, Constraints};
use roc_collections::all::MutMap;
use roc_module::ident::Lowercase;
use roc_module::symbol::Symbol;
@ -39,6 +40,31 @@ pub fn run_solve(
(solved_subs, solved_env, problems)
}
pub fn run_solve_soa(
constraints: &Constraints,
constraint: ConstraintSoa,
rigid_variables: MutMap<Variable, Lowercase>,
var_store: VarStore,
) -> (Solved<Subs>, solve::Env, Vec<solve::TypeError>) {
let env = solve::Env::default();
let mut subs = Subs::new_from_varstore(var_store);
for (var, name) in rigid_variables {
subs.rigid_var(var, name);
}
// Now that the module is parsed, canonicalized, and constrained,
// we need to type check it.
let mut problems = Vec::new();
// Run the solver to populate Subs.
let (solved_subs, solved_env) =
solve::run_soa(constraints, &env, &mut problems, subs, &constraint);
(solved_subs, solved_env, problems)
}
pub fn make_solved_types(
solved_subs: &Solved<Subs>,
exposed_vars_by_symbol: &[(Symbol, Variable)],