-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: better error message for symbol against enum #12478
Conversation
I'm not sure how useful the "some options" path is. Just listing the first 5 seems very random. Perhaps they're the most common ones, but then you probably wouldn't have completely mistyped them in the first place. |
Done! |
Co-authored-by: Sijawusz Pur Rahnama <[email protected]>
It seems this could be easily extended to multiple enum Foo
W
X
Y
end
enum Bar
Y
Z
end
def foo(x : Foo); end
def foo(x : Bar); end
foo :abc This should show |
@HertzDevil Sounds good, but I would do that in a separate PR. |
Yeah, I'm not even sure this is really relevant. How often would you get such a case where different overloads accept different enum types for the same parameter? |
…al into errors/symbol-vs-enum
Will this go into 1.6? |
Sure. I just missed adding it to the milestone. |
Another follow-up to the improved error messages.
If you have code like this:
Before this PR this was the error (I won't list "all overloads" because they are always shown):
With this PR:
Much better, don't you think?
Here the name was similar but what if it isn't? Let's try it:
We get this error:
Cool!
What if the enum member has a lot of options? We don't show what are the options in that case (if they are more than 10)
Fixes #7284