Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fix rendering of redefined Conversion error #8245
Fix rendering of redefined Conversion error #8245
Changes from 18 commits
16b0433
0353021
91e2e43
24f14d0
d95ed30
3cb7296
4a378d0
9e1c03b
9829e9b
24c0804
9a81242
7c47839
a86e32f
7934bc3
b9328bd
a4b3fea
6c2db13
6f653a6
2a37e54
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this error message may be clearer - conversions work a bit differently than method overloads - they do overload the
from
method, just with different types ofthat
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if I accidentaly do something like this:
Would the error message say "Ambiguous conversion" in that case as well? Isn't that misleading? What about trying to distinguish between those two cases - "Ambiguous conversion" VS "Method overload"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do distinguish these cases already.
The error message I have edited was only relevant for conversions, method overloads have a separate error class - I assume the error message for conversions was copy-pasted from overloads and that's why it used to say the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see here a test verifying that the behaviour is exactly as you'd expect it to be.
enso/engine/runtime/src/test/scala/org/enso/interpreter/test/semantic/OverloadsResolutionErrorTest.scala
Lines 33 to 42 in b9328bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the above test was for member methods - so just to be comprehensive I added a test case like the one you mentioned:
2a37e54
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small irrelevant fix - before printing the redefined conversion as code was leaking a lot of information by using
toString
instead ofshowCode
for thesourceType
. With that it is more compact and closer to what I thinkshowCode
is supposed to be.