diff --git a/lib/typing/typing.ml b/lib/typing/typing.ml index d4f88ae3..354958a9 100644 --- a/lib/typing/typing.ml +++ b/lib/typing/typing.ml @@ -725,6 +725,7 @@ end = struct let body = { typ = eventual_ret; expr = App { callee; args }; attr; loc } in + let body = { body with expr = Move body } in let abs = { nparams; body; func; inline = false } in { typ = this_ret; expr = Lambda (lambda_id (), abs); loc; attr } diff --git a/test/functions.t/partial_application.smu b/test/functions.t/partial_application.smu new file mode 100644 index 00000000..5919357e --- /dev/null +++ b/test/functions.t/partial_application.smu @@ -0,0 +1,3 @@ +(defn partial (a b) (fmt-str a " and " b)) +(def p (partial "lol")) +(ignore (p "rofl")) diff --git a/test/functions.t/run.t b/test/functions.t/run.t index 0ad78fc5..d480e795 100644 --- a/test/functions.t/run.t +++ b/test/functions.t/run.t @@ -2425,6 +2425,11 @@ Check allocations of nested closures total heap usage: 8 allocs, 8 frees, 240 bytes allocated Check that binops with multiple argument works - $ schmu binop.smu && ./binop + $ schmu binop.smu + $ ./binop 1 19 + +Partial application + $ schmu partial_application.smu + $ valgrind -q --leak-check=yes --show-reachable=yes ./partial_application