mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
the debugging begins
This commit is contained in:
parent
73bd647a7d
commit
c52029c2d1
6 changed files with 158 additions and 13 deletions
|
@ -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)],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue