When calling a function via a mutable alias, the compiler incorrectly generates a curried application. The only workaround I found is to use an anonymous function with tupled arguments (see mutX4).
Repro code
let x a b c = a + b + c
let y = x
let mutable mutX1 = x
let mutable mutX2 = fun a b c -> x a b c
let mutable mutX3 = fun a b c -> y a b c
let mutable mutX4 = fun (a, b, c) -> y a b c
y 1 2 3 |> ignore
mutX1 1 2 3
mutX2 1 2 3
// this is the only version that produces valid code
mutX4 (1,2, 3)
The generated code is invalid, attempting to call functions with more arguments than they accept. The compiler should either fail and require the user to write out a tupled forwarding function (as is the case for attempting to define an explicit mutable function Mutable function values should be written 'let mutable f = (fun args -> ...)'), or ideally, the correct forwarding arguments are generated and no special handling is needed.
Description
When calling a function via a mutable alias, the compiler incorrectly generates a curried application. The only workaround I found is to use an anonymous function with tupled arguments (see mutX4).
Repro code
Fable repl
Expected and actual results
The generated code is invalid, attempting to call functions with more arguments than they accept. The compiler should either fail and require the user to write out a tupled forwarding function (as is the case for attempting to define an explicit mutable function
Mutable function values should be written 'let mutable f = (fun args -> ...)'
), or ideally, the correct forwarding arguments are generated and no special handling is needed.Related information