builtins are not technically imported

This commit is contained in:
Folkert 2020-11-02 23:19:31 +01:00
parent 16fbff6eda
commit a565ca79b8
2 changed files with 21 additions and 3 deletions

View file

@ -968,6 +968,16 @@ impl<'a> Expr<'a> {
}
impl<'a> Stmt<'a> {
pub fn new(
env: &mut Env<'a, '_>,
can_expr: roc_can::expr::Expr,
var: Variable,
procs: &mut Procs<'a>,
layout_cache: &mut LayoutCache<'a>,
) -> Self {
from_can(env, var, can_expr, procs, layout_cache)
}
pub fn to_doc<'b, D, A>(&'b self, alloc: &'b D) -> DocBuilder<'b, D, A>
where
D: DocAllocator<'b, A>,
@ -4459,7 +4469,10 @@ fn call_by_name<'a>(
// exactly once.
match &mut procs.pending_specializations {
Some(pending_specializations) => {
if assigned.module_id() != proc_name.module_id() {
let is_imported = assigned.module_id() != proc_name.module_id();
// builtins are currently (re)defined in each module, so not really imported
let is_builtin = proc_name.is_builtin();
if is_imported && !is_builtin {
specialize_imported_symbol(
env,
&mut procs.externals_we_need,

View file

@ -95,8 +95,13 @@ mod test_reporting {
home,
ident_ids: &mut ident_ids,
};
let _mono_expr =
Stmt::new(&mut mono_env, loc_expr.value, &mut procs, &mut layout_cache);
let _mono_expr = Stmt::new(
&mut mono_env,
loc_expr.value,
var,
&mut procs,
&mut layout_cache,
);
}
Ok((unify_problems, can_problems, mono_problems, home, interns))