move over constraint

This commit is contained in:
Folkert 2022-03-02 21:19:25 +01:00
parent 8d2e0a738c
commit 0eb98a4c59
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
11 changed files with 429 additions and 1417 deletions

View file

@ -1,6 +1,5 @@
use crate::solve;
use roc_can::constraint::Constraint;
use roc_can::constraint_soa::{Constraint as ConstraintSoa, Constraints};
use roc_can::constraint::{Constraint as ConstraintSoa, Constraints};
use roc_collections::all::MutMap;
use roc_module::ident::Lowercase;
use roc_module::symbol::Symbol;
@ -17,29 +16,6 @@ pub struct SolvedModule {
pub problems: Vec<solve::TypeError>,
}
pub fn run_solve(
rigid_variables: MutMap<Variable, Lowercase>,
constraint: Constraint,
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(&env, &mut problems, subs, &constraint);
(solved_subs, solved_env, problems)
}
pub fn run_solve_soa(
constraints: &Constraints,
constraint: ConstraintSoa,