-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Fixes issue with generic trait impls using the same method names. #3676
Conversation
2cfa494
to
89a0a97
Compare
Upon further investigation, #3633 isn't a bug after all, but instead a matter of showing the user a bad error message. Apologies for adding this additional context after have submitted this PR 😭 I'm going to close this PR and remove your assignment from #3633 for bookkeeping, but please feel free to re-add your assignment to #3633 if you'd like to continue working on that GH issue. |
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.
This PR looks very close! Just a few comments left to address.
89a0a97
to
a930f01
Compare
When two generic trait implementation use the same method implementation an error such as `Duplicate definition for method "convert" for type "A"` would occur. This fix does remove the error when a method with diferent type parameters is added to another trait implementation with different type parameters. The fix also ensures that find_method_for_type returns a method whose parameters types matches the given arguments expressions return types. Closes FuelLabs#3633.
e1fbb3e
to
4154540
Compare
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.
Approved based on the testing added to demonstrate the effectiveness of the fix, but needs a compiler team member for final review.
(I wrote a review comment but it's showing up under the fold of a previous resolved comment. CC @esdrubal) |
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.
This looks really good @esdrubal 🎉 I appreciate your persistence with this PR through the re-review process.
) When two generic trait implementation use the same method name with a different type parameter an error such as `Duplicate definition for method "convert" for type "A"` would occur. This fix does remove the error when a method with diferent type parameters is added to another trait implementation with different type parameters. The fix also ensures that when possible find_method_for_type returns a method whose parameters types matches the given arguments expressions return types. Closes #3633. --------- Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
When two generic trait implementation use the same method name with a different type parameter an error such as
Duplicate definition for method "convert" for type "A"
would occur.This fix does remove the error when a method with diferent type parameters is added to another trait implementation with different type parameters.
The fix also ensures that when possible find_method_for_type returns a method whose parameters types matches the given arguments expressions return types.
Closes #3633.