mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
move over constraint
This commit is contained in:
parent
8d2e0a738c
commit
0eb98a4c59
11 changed files with 429 additions and 1417 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue