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

Compiler: only give named args errors when there's a single overload #7288

Merged

Conversation

asterite
Copy link
Member

@asterite asterite commented Jan 9, 2019

Fixes #7281

The compiler would try to determine if you already specified a named arguments solely based on the number of arguments, their position and the name of named arguments. But this might lead to false positives when there are multiple overloads.

For safety, this PR just triggers that other error message when there's a single overload, when it's safe to say so. In any other case the usual "no overload matches" is shown, which also lets you see which arguments you passed and which overloads are available. This can always be improved in the future, but for now it's better to not give misleading directions.

@asterite asterite added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Jan 9, 2019
@asterite asterite added this to the 0.27.1 milestone Jan 9, 2019
@asterite asterite merged commit 1e11af5 into crystal-lang:master Jan 9, 2019
@asterite asterite deleted the bug/incorrect-named-args-error branch March 30, 2019 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants