fuzion
fuzion copied to clipboard
lambda targets whose outer features have arguments do not work and will create strange errors.
Try this
o(a i32) is
F ref is
c(a i32) i32 : fuzion.lambda_target => abstract
_ F := x->x+1 # should work, but does not
_ o.F := x->x+1 # cannot work, but produces confusing error
Produces a strange errors for the both uses of F as a target for a `lambda:
> ./build/bin/fz test_lambda.fz
/home/fridi/fuzion/fuzion/test_lambda.fz:7:10: error 1: Different count of arguments needed when calling feature
_ o.F := x->x+1 # cannot work, but produces confusing error
Feature not found: 'o' (no arguments)
Target feature: 'universe'
In call: 'x->x+1'
To solve this, you might change the actual number of arguments to match the feature 'o' (one value argument a) at /home/fridi/fuzion/fuzion/test_lambda.fz:1:1:
o(a i32) is
To call 'o', you must provide one argument.
/home/fridi/fuzion/fuzion/test_lambda.fz:5:10: error 2: Different count of arguments needed when calling feature
_ F := x->x+1 # should work, but does not
Feature not found: 'o' (no arguments)
Target feature: 'o'
In call: 'x->x+1'
To solve this, you might change the actual number of arguments to match the feature 'o' (one value argument a) at /home/fridi/fuzion/fuzion/test_lambda.fz:1:1:
o(a i32) is
To call 'o', you must provide one argument.
2 errors.
Ideally, the first use should work using o.this as the outer instance of the lambda, while the second case should create a better error messages (stating that the outer feature of a lambda must not expect arguments).