fix Closure3

This commit is contained in:
Folkert 2021-02-18 20:27:37 +01:00
parent 0cdea4e36a
commit 34007651ac
3 changed files with 9 additions and 4 deletions

View file

@ -252,7 +252,6 @@ mod cli_run {
} }
#[test] #[test]
#[ignore]
#[serial(closure3)] #[serial(closure3)]
fn closure3() { fn closure3() {
check_output( check_output(

View file

@ -5692,7 +5692,11 @@ fn call_by_pointer<'a>(
// foo1 = \x -> foo x // foo1 = \x -> foo x
// //
// x = List.map [ ... ] foo1 // x = List.map [ ... ] foo1
if env.is_imported_symbol(symbol) || procs.partial_procs.contains_key(&symbol) {
// TODO can we cache this `any`?
let is_specialized = procs.specialized.keys().any(|(s, _)| *s == symbol);
if env.is_imported_symbol(symbol) || procs.partial_procs.contains_key(&symbol) || is_specialized
{
match layout { match layout {
Layout::FunctionPointer(arg_layouts, ret_layout) => { Layout::FunctionPointer(arg_layouts, ret_layout) => {
if arg_layouts.iter().any(|l| l.contains_refcounted()) { if arg_layouts.iter().any(|l| l.contains_refcounted()) {
@ -5746,7 +5750,10 @@ fn call_by_pointer<'a>(
Expr::FunctionPointer(symbol, layout) Expr::FunctionPointer(symbol, layout)
} }
} }
_ => unreachable!("not a function pointer layout"), _ => {
// e.g. Num.maxInt or other constants
Expr::FunctionPointer(symbol, layout)
}
} }
} else { } else {
Expr::FunctionPointer(symbol, layout) Expr::FunctionPointer(symbol, layout)

View file

@ -12,4 +12,3 @@ main =
Task.succeed {} Task.succeed {}
|> Task.after (\_ -> Task.succeed x |> Task.map (\_ -> {})) |> Task.after (\_ -> Task.succeed x |> Task.map (\_ -> {}))