mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Basic type inference and solving for abilities
Note that is still pretty limited. We only permit opaque types to implement abilities, abilities cannot have type arguments, and also no other functions may depend on abilities
This commit is contained in:
parent
913d97cab1
commit
15a040ec87
25 changed files with 1808 additions and 477 deletions
|
@ -1,4 +1,5 @@
|
|||
use crate::solve::{self, Aliases};
|
||||
use roc_can::abilities::AbilitiesStore;
|
||||
use roc_can::constraint::{Constraint as ConstraintSoa, Constraints};
|
||||
use roc_can::module::RigidVariables;
|
||||
use roc_collections::all::MutMap;
|
||||
|
@ -32,13 +33,23 @@ pub fn run_solve(
|
|||
rigid_variables: RigidVariables,
|
||||
mut subs: Subs,
|
||||
mut aliases: Aliases,
|
||||
) -> (Solved<Subs>, solve::Env, Vec<solve::TypeError>) {
|
||||
mut abilities_store: AbilitiesStore,
|
||||
) -> (
|
||||
Solved<Subs>,
|
||||
solve::Env,
|
||||
Vec<solve::TypeError>,
|
||||
AbilitiesStore,
|
||||
) {
|
||||
let env = solve::Env::default();
|
||||
|
||||
for (var, name) in rigid_variables.named {
|
||||
subs.rigid_var(var, name);
|
||||
}
|
||||
|
||||
for (var, (name, ability)) in rigid_variables.able {
|
||||
subs.rigid_able_var(var, name, ability);
|
||||
}
|
||||
|
||||
for var in rigid_variables.wildcards {
|
||||
subs.rigid_var(var, "*".into());
|
||||
}
|
||||
|
@ -55,9 +66,10 @@ pub fn run_solve(
|
|||
subs,
|
||||
&mut aliases,
|
||||
&constraint,
|
||||
&mut abilities_store,
|
||||
);
|
||||
|
||||
(solved_subs, solved_env, problems)
|
||||
(solved_subs, solved_env, problems, abilities_store)
|
||||
}
|
||||
|
||||
pub fn exposed_types_storage_subs(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue