-
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
Bug with duplicate impl blocks defined for the same type with different type parameters. #3633
Comments
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 different type parameters is added and also ensures that find_method_for_type returns a method whose parameters types matches the given arguments expressions return types. Closes FuelLabs#3633.
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.
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.
This is not a bug---this case should not be allowed and it is true that these implementations are conflicting. This is because the generic type "B" is equivalent to the generic type "C", they are both "a generic type" without any additional information. i.e. when the user calls the method See here for this same case in Rust: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=293dbb6a1a51a2c06fba457340e430d6 We should make the error message more clear though---I will change this issue to reflect this. |
@emilyaherbert I think in @nfurfaro's example, The use case here is being able to implement |
@mohammadfawaz is correct; sorry if my attempt at a simple repro is misleading and/or incorrect. |
Oh I see, apologies for my mistake! Thanks so much for clarifying @mohammadfawaz and @nfurfaro. Yes in this case the original bug description is correct 😄 |
No no, just a brain fart on my end haha. |
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.
@esdrubal It looks like you may have a fix for this in the works? |
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.
) 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. --------- Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
The following code won't compile. The error is:
The text was updated successfully, but these errors were encountered: