Skip to content
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

Improve errors reported when a named argument is misspelled at callsite #12316

Closed
radeusgd opened this issue Feb 18, 2025 · 2 comments · Fixed by #12238
Closed

Improve errors reported when a named argument is misspelled at callsite #12316

radeusgd opened this issue Feb 18, 2025 · 2 comments · Fixed by #12238
Assignees

Comments

@radeusgd
Copy link
Member

Followup of #7359.

Currently due to how currying and named arguments passing works in Enso, when a function is called with a named argument that is misspelled, and the needed argument is optional (has a default value), the user will see:

Type error: expected a function but got [Some value]

That is because the interpreter is trying to apply more arguments, filling in unmatched arguments with default values when available, hoping that the returned value might be a function that will take the matching argument name. But most of the time the result is not a new function but some value.

If the arguments are not all optional, then at least we get a not-fully applied function with oversaturated argument, e.g.:

f.f[file.enso:3-4] self=f a=_ b=_ +d=4

The goal of this ticket is to improve the first case and give the user more information on the Type error.

@radeusgd
Copy link
Member Author

The idea is to catch the place where the argument becomes oversaturated and if the later execution is to cause a type error AND that oversaturated argument was named, to add additional information to the error:

The named argument `d` did not match any argument names. Perhaps it is misspelled?

@enso-bot
Copy link

enso-bot bot commented Feb 20, 2025

Radosław Waśko reports a new STANDUP for yesterday (2025-02-19):

Progress: Continuing investigating the benchmarks, after all it seems the results are acceptable - will merge the error handling PR. Some work on adapting the Linter but not yet finished. Meetings, reviews. It should be finished by 2025-02-19.

Next Day: Next day I will be working on the #12334 task. Finish changes to the Linter, do some Type inference work.

@mergify mergify bot closed this as completed in #12238 Feb 20, 2025
mergify bot pushed a commit that referenced this issue Feb 20, 2025
- Related to further work discussed in #7359
- Closes #12316
@github-project-automation github-project-automation bot moved this from 🔧 Implementation to 🟢 Accepted in Issues Board Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🟢 Accepted
Development

Successfully merging a pull request may close this issue.

1 participant