mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
expose rigids introduced by builtins
they aren't used yet, because their names can 'leak'. Not sure what the best way forward is here
This commit is contained in:
parent
b9b2f70673
commit
fefac9580e
5 changed files with 55 additions and 20 deletions
|
@ -152,8 +152,10 @@ pub fn uniq_expr_with(
|
|||
.collect();
|
||||
|
||||
// load builtin values
|
||||
let constraint =
|
||||
roc_constrain::module::constrain_imported_values(imports, constraint, &var_store);
|
||||
|
||||
// TODO what to do with those rigids?
|
||||
let (_introduced_rigids, constraint) =
|
||||
roc::constrain::module::constrain_imported_values(imports, constraint, &var_store);
|
||||
|
||||
// load builtin types
|
||||
let mut constraint =
|
||||
|
@ -205,7 +207,7 @@ pub fn can_expr_with(arena: &Bump, home: ModuleId, expr_str: &str) -> CanExprOut
|
|||
let mut scope = Scope::new(home);
|
||||
let dep_idents = IdentIds::exposed_builtins(0);
|
||||
let mut env = Env::new(home, dep_idents, &module_ids, IdentIds::default());
|
||||
let (loc_expr, output) = canonicalize_expr(
|
||||
let (loc_expr, mut output) = canonicalize_expr(
|
||||
&mut env,
|
||||
&var_store,
|
||||
&mut scope,
|
||||
|
@ -234,8 +236,13 @@ pub fn can_expr_with(arena: &Bump, home: ModuleId, expr_str: &str) -> CanExprOut
|
|||
.collect();
|
||||
|
||||
//load builtin values
|
||||
let constraint =
|
||||
roc_constrain::module::constrain_imported_values(imports, constraint, &var_store);
|
||||
let (_introduced_rigids, constraint) =
|
||||
roc::constrain::module::constrain_imported_values(imports, constraint, &var_store);
|
||||
|
||||
// TODO determine what to do with those rigids
|
||||
// for var in introduced_rigids {
|
||||
// output.ftv.insert(var, format!("internal_{:?}", var).into());
|
||||
// }
|
||||
|
||||
//load builtin types
|
||||
let mut constraint = roc_constrain::module::load_builtin_aliases(
|
||||
|
|
|
@ -2097,4 +2097,22 @@ mod test_infer_uniq {
|
|||
"Attr * Int",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn update_cost() {
|
||||
infer_eq(
|
||||
indoc!(
|
||||
r#"
|
||||
f = \r ->
|
||||
g = r.q
|
||||
h = r.p
|
||||
|
||||
42
|
||||
|
||||
f
|
||||
"#
|
||||
),
|
||||
"Attr * (Attr (* | a | b) { p : (Attr b *), q : (Attr a *) }* -> Attr * Int)",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue