Skip to content

wrong argument count causes different error if feature with same name and no arguments exists #5062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
simonvonhackewitz opened this issue Apr 14, 2025 · 0 comments
Labels
enhancement New feature or request front end related to the front end until .fum file is created: call and type resolution, type checking, etc.

Comments

@simonvonhackewitz
Copy link
Collaborator

simonvonhackewitz commented Apr 14, 2025

Calling a feature with wrong argument count causes this error that suggests features with same name and different argument count

x(a i32) => "test"
x(a,b,c i32) => "test"
x 1 2
❯ fz /tmp/test.fz

/tmp/test.fz:3:1: error 1: Different count of arguments needed when calling feature
x 1 2

Feature not found: 'x' (2 arguments)
Target feature: 'universe'
In call: 'x 1 2'
To solve this, you might change the actual number of arguments to match one of the features 'x' (one argument) at /tmp/test.fz:1:1:
x(a i32) => "test"

, or
'x' (3 arguments) at /tmp/test.fz:2:1:
x(a,b,c i32) => "test"


one error.

However, if there is a feature with the same name and no arguments, only the feature with no arguments is suggested

x(a i32) => "test"
x => "test"
x 1 2
❯ fz /tmp/test.fz            

/tmp/test.fz:3:1: error 1: Wrong number of actual arguments in call
x 1 2

Number of actual arguments is 2, while call expects no arguments.
Called feature: 'x'
Formal arguments: 
Declared at /tmp/test.fz:2:1:
x => "test"


one error.
@simonvonhackewitz simonvonhackewitz added enhancement New feature or request front end related to the front end until .fum file is created: call and type resolution, type checking, etc. labels Apr 14, 2025
@simonvonhackewitz simonvonhackewitz changed the title wrong argument count error different if feature with same name and no arguments exists wrong argument count causes different error if feature with same name and no arguments exists Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request front end related to the front end until .fum file is created: call and type resolution, type checking, etc.
Projects
None yet
Development

No branches or pull requests

1 participant