mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
make Hello.roc work
This commit is contained in:
parent
8f95647c00
commit
a75ddbba5e
1 changed files with 13 additions and 11 deletions
|
@ -1792,11 +1792,8 @@ fn specialize_all_help<'a>(
|
||||||
Ok((proc, layout)) => {
|
Ok((proc, layout)) => {
|
||||||
if procs.module_thunks.contains(&name) {
|
if procs.module_thunks.contains(&name) {
|
||||||
let top_level = TopLevelFunctionLayout::from_layout(env.arena, layout);
|
let top_level = TopLevelFunctionLayout::from_layout(env.arena, layout);
|
||||||
let layout = TopLevelFunctionLayout {
|
debug_assert_eq!(top_level.arguments, &[]);
|
||||||
arguments: &[],
|
procs.specialized.insert((name, top_level), Done(proc));
|
||||||
result: env.arena.alloc(top_level).full(),
|
|
||||||
};
|
|
||||||
procs.specialized.insert((name, layout), Done(proc));
|
|
||||||
} else {
|
} else {
|
||||||
let top_level = TopLevelFunctionLayout::from_layout(env.arena, layout);
|
let top_level = TopLevelFunctionLayout::from_layout(env.arena, layout);
|
||||||
procs.specialized.insert((name, top_level), Done(proc));
|
procs.specialized.insert((name, top_level), Done(proc));
|
||||||
|
@ -6086,13 +6083,11 @@ fn call_by_name_new<'a>(
|
||||||
procs: &mut Procs<'a>,
|
procs: &mut Procs<'a>,
|
||||||
fn_var: Variable,
|
fn_var: Variable,
|
||||||
proc_name: Symbol,
|
proc_name: Symbol,
|
||||||
mut loc_args: std::vec::Vec<(Variable, Located<roc_can::expr::Expr>)>,
|
loc_args: std::vec::Vec<(Variable, Located<roc_can::expr::Expr>)>,
|
||||||
layout_cache: &mut LayoutCache<'a>,
|
layout_cache: &mut LayoutCache<'a>,
|
||||||
assigned: Symbol,
|
assigned: Symbol,
|
||||||
hole: &'a Stmt<'a>,
|
hole: &'a Stmt<'a>,
|
||||||
) -> Stmt<'a> {
|
) -> Stmt<'a> {
|
||||||
let original_fn_var = fn_var;
|
|
||||||
|
|
||||||
// Register a pending_specialization for this function
|
// Register a pending_specialization for this function
|
||||||
match layout_cache.from_var(env.arena, fn_var, env.subs) {
|
match layout_cache.from_var(env.arena, fn_var, env.subs) {
|
||||||
Err(LayoutProblem::UnresolvedTypeVar(var)) => {
|
Err(LayoutProblem::UnresolvedTypeVar(var)) => {
|
||||||
|
@ -6156,9 +6151,16 @@ fn call_by_name_new<'a>(
|
||||||
hole,
|
hole,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
_ => panic!(
|
Ok(other) if loc_args.is_empty() => {
|
||||||
"calling {:?}, which is not a function nor a module thunk",
|
// this is a 0-argument thunk
|
||||||
proc_name,
|
if env.is_imported_symbol(proc_name) {
|
||||||
|
add_needed_external(procs, env, fn_var, proc_name);
|
||||||
|
}
|
||||||
|
force_thunk(env, proc_name, other, assigned, hole)
|
||||||
|
}
|
||||||
|
other => panic!(
|
||||||
|
"calling {:?}, which is not a function but received arguments, and is a {:?}",
|
||||||
|
proc_name, other,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue