fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

Implicit call to `.call` does not work if type is type parameter with constraint being lambda target

Open fridis opened this issue 2 months ago • 0 comments

Take this code using a type parameter with constraint i32->i32:

apply(f F : i32->i32) => f 42

_ := apply *2

it produces an error:

 > ./build/bin/fz type_parameter_example6.fz

/home/fridi/fuzion/fuzion/type_parameter_example6.fz:1:26: error 1: Wrong number of actual value arguments in call
apply(f F : i32->i32) => f 42

Number of actual value arguments is 1, while call expects no value arguments.
Actual value arguments: '42'
Called feature: 'apply.f'
Formal value arguments: --none--
Declared at /home/fridi/fuzion/fuzion/type_parameter_example6.fz:1:7:
apply(f F : i32->i32) => f 42


one error.

Using no type parameter

 > cat type_parameter_example6a.fz
apply(f i32->i32) => f 42

_ := apply *2

does not cause this error:

 > ./build/bin/fz type_parameter_example6a.fz
 >

Or using an explicit .call

 > cat type_parameter_example6b.fz
apply(f F : i32->i32) => f.call 42

_ := apply *2

also avoids this problem:

 > ./build/bin/fz type_parameter_example6b.fz
 >

fridis avatar Oct 16 '25 13:10 fridis