From 3e586e378b801801476446c4f7b6faa997570706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Tue, 21 May 2024 14:54:40 +0200 Subject: [PATCH] Partial application fix --- compiler/lib/wasm/wa_generate.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/lib/wasm/wa_generate.ml b/compiler/lib/wasm/wa_generate.ml index eb28a1435..5e5dcaf4c 100644 --- a/compiler/lib/wasm/wa_generate.ml +++ b/compiler/lib/wasm/wa_generate.ml @@ -112,9 +112,10 @@ module Generate (Target : Wa_target_sig.S) = struct match kind, funct with | `Index, W.ConstSym (V g, 0) | `Ref _, W.RefFunc g -> (* Functions with constant closures ignore their - environment *) - let* unit = Value.unit in - return (W.Call (g, List.rev (unit :: acc))) + environment. In case of partial application, we + still need the closure. *) + let* cl = if exact then Value.unit else return closure in + return (W.Call (g, List.rev (cl :: acc))) | `Index, _ -> return (W.Call_indirect