-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the bug regarding methods not being found for types. (#3866)
This PR fixes #3864 by changing the way that trait impls are re-exported to the greater namespace. Previously they we reexported somewhat at random, with one place being at function declaration sites. They _were not_ reexported at function call sites and method call sites. This PR changes this so to standardize the re-export locations to include function call sites and method call sites and to exclude function declaration sites. This PR serves as an alternate fix to #3324, as the bug with this issue involved re-exporting traits. Take this Sway example: ```rust script; use core::ops::*; impl<T> Option<T> { pub fn ok_or<E>(self, err: E) -> Result<T, E> { match self { Option::Some(v) => Result::Ok(v), Option::None => Result::Err(err), } } } fn test_ok_or<T, E>(val: T, default: E) where T: Eq { match Option::Some(val).ok_or(default) { Result::Ok(inner) => assert(inner == val), Result::Err(_) => revert(0), } } fn main() {} ``` This PR better serves to re-export the trait constraint `T: Eq` to the usable namespace inside of the function body for `ok_or`. So, this PR also removes the `unify_map` abstraction which was added to the `TypeEngine` in #3348. Closes #3864 Co-authored-by: emilyaherbert <emily.herbert@fuel.sh>
- Loading branch information
1 parent
63670c4
commit 3998c10
Showing
10 changed files
with
55 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.