mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Remove imported_builtins from load
This commit is contained in:
parent
f06c2af4f1
commit
98287e7670
4 changed files with 50 additions and 65 deletions
|
@ -5,7 +5,6 @@ use crossbeam::deque::{Injector, Stealer, Worker};
|
|||
use crossbeam::thread;
|
||||
use parking_lot::Mutex;
|
||||
use roc_builtins::roc::module_source;
|
||||
use roc_builtins::std::borrow_stdlib;
|
||||
use roc_can::abilities::{AbilitiesStore, PendingAbilitiesStore, ResolvedSpecializations};
|
||||
use roc_can::constraint::{Constraint as ConstraintSoa, Constraints};
|
||||
use roc_can::expr::Declarations;
|
||||
|
@ -14,7 +13,7 @@ use roc_can::module::{
|
|||
canonicalize_module_defs, ExposedByModule, ExposedForModule, ExposedModuleTypes, Module,
|
||||
};
|
||||
use roc_collections::{default_hasher, BumpMap, MutMap, MutSet, VecMap, VecSet};
|
||||
use roc_constrain::module::{constrain_builtin_imports, constrain_module};
|
||||
use roc_constrain::module::constrain_module;
|
||||
use roc_debug_flags::dbg_do;
|
||||
#[cfg(debug_assertions)]
|
||||
use roc_debug_flags::{
|
||||
|
@ -977,7 +976,6 @@ enum BuildTask<'a> {
|
|||
Solve {
|
||||
module: Module,
|
||||
ident_ids: IdentIds,
|
||||
imported_builtins: Vec<Symbol>,
|
||||
exposed_for_module: ExposedForModule,
|
||||
module_timing: ModuleTiming,
|
||||
constraints: Constraints,
|
||||
|
@ -3758,18 +3756,10 @@ impl<'a> BuildTask<'a> {
|
|||
let exposed_for_module =
|
||||
ExposedForModule::new(module.referenced_values.iter(), exposed_by_module);
|
||||
|
||||
let imported_builtins = module
|
||||
.referenced_values
|
||||
.iter()
|
||||
.filter(|s| s.is_builtin())
|
||||
.copied()
|
||||
.collect();
|
||||
|
||||
// Next, solve this module in the background.
|
||||
Self::Solve {
|
||||
module,
|
||||
ident_ids,
|
||||
imported_builtins,
|
||||
exposed_for_module,
|
||||
constraints,
|
||||
constraint,
|
||||
|
@ -3903,12 +3893,11 @@ pub fn add_imports(
|
|||
|
||||
#[allow(clippy::complexity)]
|
||||
fn run_solve_solve(
|
||||
imported_builtins: Vec<Symbol>,
|
||||
exposed_for_module: ExposedForModule,
|
||||
mut constraints: Constraints,
|
||||
constraint: ConstraintSoa,
|
||||
pending_derives: PendingDerives,
|
||||
mut var_store: VarStore,
|
||||
var_store: VarStore,
|
||||
module: Module,
|
||||
derived_symbols: GlobalDerivedSymbols,
|
||||
) -> (
|
||||
|
@ -3926,8 +3915,8 @@ fn run_solve_solve(
|
|||
..
|
||||
} = module;
|
||||
|
||||
let (mut rigid_vars, mut def_types) =
|
||||
constrain_builtin_imports(borrow_stdlib(), imported_builtins, &mut var_store);
|
||||
let mut rigid_vars: Vec<Variable> = Vec::new();
|
||||
let mut def_types: Vec<(Symbol, Loc<roc_types::types::Type>)> = Vec::new();
|
||||
|
||||
let mut subs = Subs::new_from_varstore(var_store);
|
||||
|
||||
|
@ -4006,7 +3995,6 @@ fn run_solve<'a>(
|
|||
module: Module,
|
||||
ident_ids: IdentIds,
|
||||
mut module_timing: ModuleTiming,
|
||||
imported_builtins: Vec<Symbol>,
|
||||
exposed_for_module: ExposedForModule,
|
||||
constraints: Constraints,
|
||||
constraint: ConstraintSoa,
|
||||
|
@ -4028,7 +4016,6 @@ fn run_solve<'a>(
|
|||
if module_id.is_builtin() {
|
||||
match cached_subs.lock().remove(&module_id) {
|
||||
None => run_solve_solve(
|
||||
imported_builtins,
|
||||
exposed_for_module,
|
||||
constraints,
|
||||
constraint,
|
||||
|
@ -4051,7 +4038,6 @@ fn run_solve<'a>(
|
|||
}
|
||||
} else {
|
||||
run_solve_solve(
|
||||
imported_builtins,
|
||||
exposed_for_module,
|
||||
constraints,
|
||||
constraint,
|
||||
|
@ -4863,7 +4849,6 @@ fn run_task<'a>(
|
|||
Solve {
|
||||
module,
|
||||
module_timing,
|
||||
imported_builtins,
|
||||
exposed_for_module,
|
||||
constraints,
|
||||
constraint,
|
||||
|
@ -4878,7 +4863,6 @@ fn run_task<'a>(
|
|||
module,
|
||||
ident_ids,
|
||||
module_timing,
|
||||
imported_builtins,
|
||||
exposed_for_module,
|
||||
constraints,
|
||||
constraint,
|
||||
|
|
|
@ -2142,6 +2142,7 @@ fn compact_lambda_set<P: Phase>(
|
|||
);
|
||||
}
|
||||
(_, Some(specialization)) => {
|
||||
dbg!(opaque_home);
|
||||
let specialized_lambda_set = *specialization
|
||||
.specialization_lambda_sets
|
||||
.get(&r)
|
||||
|
|
|
@ -3434,7 +3434,7 @@ mod solve_expr {
|
|||
Dict.insert
|
||||
"#
|
||||
),
|
||||
"Dict a b, a, b -> Dict a b",
|
||||
"Dict k v, k, v -> Dict k v",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3446,7 +3446,7 @@ mod solve_expr {
|
|||
Num.toFrac
|
||||
"#
|
||||
),
|
||||
"Num * -> Float *",
|
||||
"Num * -> Float a",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3470,7 +3470,7 @@ mod solve_expr {
|
|||
Num.ceiling
|
||||
"#
|
||||
),
|
||||
"Float * -> Int *",
|
||||
"Float * -> Int a",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3482,7 +3482,7 @@ mod solve_expr {
|
|||
Num.floor
|
||||
"#
|
||||
),
|
||||
"Float * -> Int *",
|
||||
"Float * -> Int a",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4037,7 +4037,7 @@ mod solve_expr {
|
|||
List.walkBackwards
|
||||
"#
|
||||
),
|
||||
"List a, b, (b, a -> b) -> b",
|
||||
"List elem, state, (state, elem -> state) -> state",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4065,7 +4065,7 @@ mod solve_expr {
|
|||
List.dropAt
|
||||
"#
|
||||
),
|
||||
"List a, Nat -> List a",
|
||||
"List elem, Nat -> List elem",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4101,7 +4101,7 @@ mod solve_expr {
|
|||
List.takeFirst
|
||||
"#
|
||||
),
|
||||
"List a, Nat -> List a",
|
||||
"List elem, Nat -> List elem",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4113,7 +4113,7 @@ mod solve_expr {
|
|||
List.takeLast
|
||||
"#
|
||||
),
|
||||
"List a, Nat -> List a",
|
||||
"List elem, Nat -> List elem",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4125,7 +4125,7 @@ mod solve_expr {
|
|||
List.sublist
|
||||
"#
|
||||
),
|
||||
"List a, { len : Nat, start : Nat } -> List a",
|
||||
"List elem, { len : Nat, start : Nat } -> List elem",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4133,7 +4133,7 @@ mod solve_expr {
|
|||
fn list_split() {
|
||||
infer_eq_without_problem(
|
||||
indoc!("List.split"),
|
||||
"List a, Nat -> { before : List a, others : List a }",
|
||||
"List elem, Nat -> { before : List elem, others : List elem }",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4145,7 +4145,7 @@ mod solve_expr {
|
|||
List.dropLast
|
||||
"#
|
||||
),
|
||||
"List a -> List a",
|
||||
"List elem -> List elem",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4157,7 +4157,7 @@ mod solve_expr {
|
|||
List.intersperse
|
||||
"#
|
||||
),
|
||||
"List a, a -> List a",
|
||||
"List elem, elem -> List elem",
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
|
@ -5517,7 +5517,7 @@ mod solve_expr {
|
|||
}
|
||||
"#
|
||||
),
|
||||
r#"{ toI128 : Int * -> I128, toI16 : Int * -> I16, toI32 : Int * -> I32, toI64 : Int * -> I64, toI8 : Int * -> I8, toNat : Int * -> Nat, toU128 : Int * -> U128, toU16 : Int * -> U16, toU32 : Int * -> U32, toU64 : Int * -> U64, toU8 : Int * -> U8 }"#,
|
||||
r#"{ toI128 : Int * -> I128, toI16 : Int a -> I16, toI32 : Int b -> I32, toI64 : Int c -> I64, toI8 : Int d -> I8, toNat : Int e -> Nat, toU128 : Int f -> U128, toU16 : Int g -> U16, toU32 : Int h -> U32, toU64 : Int i -> U64, toU8 : Int j -> U8 }"#,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -5532,7 +5532,7 @@ mod solve_expr {
|
|||
}
|
||||
"#
|
||||
),
|
||||
r#"{ toF32 : Num * -> F32, toF64 : Num * -> F64 }"#,
|
||||
r#"{ toF32 : Num * -> F32, toF64 : Num a -> F64 }"#,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -8941,7 +8941,7 @@ All branches in an `if` must have the same type!
|
|||
go goal new
|
||||
"#
|
||||
),
|
||||
@r#"
|
||||
@r###"
|
||||
── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─
|
||||
|
||||
The 1st argument to `remove` is not what I expect:
|
||||
|
@ -8955,7 +8955,7 @@ All branches in an `if` must have the same type!
|
|||
|
||||
But `remove` needs the 1st argument to be:
|
||||
|
||||
Set a
|
||||
Set k
|
||||
|
||||
Tip: The type annotation uses the type variable `a` to say that this
|
||||
definition can produce any type of value. But in the body I see that
|
||||
|
@ -8988,7 +8988,7 @@ All branches in an `if` must have the same type!
|
|||
infinitely.
|
||||
|
||||
Set ∞
|
||||
"#
|
||||
"###
|
||||
);
|
||||
|
||||
test_report!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue