-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Fixes insert_trait_implementaion for nested generics. #6827
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
70087aa
Fixes insert_trait_implementaion for nsted generics.
esdrubal 7c4e831
Merge branch 'master' into esdrubal/6825_nested_generics2
JoshuaBatty 8ac14c7
Merge branch 'master' into esdrubal/6825_nested_generics2
sdankel 91a2977
Merge branch 'master' into esdrubal/6825_nested_generics2
JoshuaBatty bf6b9e8
Merge branch 'master' into esdrubal/6825_nested_generics2
JoshuaBatty 63037b9
Merge branch 'master' into esdrubal/6825_nested_generics2
JoshuaBatty b114b4d
Merge branch 'master' into esdrubal/6825_nested_generics2
JoshuaBatty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
13 changes: 13 additions & 0 deletions
13
test/src/e2e_vm_tests/test_programs/should_pass/language/nested_generics/Forc.lock
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[[package]] | ||
name = "core" | ||
source = "path+from-root-9C31758901D851EE" | ||
|
||
[[package]] | ||
name = "nested_generics" | ||
source = "member" | ||
dependencies = ["std"] | ||
|
||
[[package]] | ||
name = "std" | ||
source = "path+from-root-9C31758901D851EE" | ||
dependencies = ["core"] |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_pass/language/nested_generics/Forc.toml
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[project] | ||
authors = ["Fuel Labs <[email protected]>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "nested_generics" | ||
|
||
[dependencies] | ||
std = { path = "../../../../reduced_std_libs/sway-lib-std-assert" } |
25 changes: 25 additions & 0 deletions
25
.../src/e2e_vm_tests/test_programs/should_pass/language/nested_generics/json_abi_oracle.json
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"configurables": [], | ||
"functions": [ | ||
{ | ||
"attributes": null, | ||
"inputs": [], | ||
"name": "main", | ||
"output": { | ||
"name": "", | ||
"type": 0, | ||
"typeArguments": null | ||
} | ||
} | ||
], | ||
"loggedTypes": [], | ||
"messagesTypes": [], | ||
"types": [ | ||
{ | ||
"components": null, | ||
"type": "bool", | ||
"typeId": 0, | ||
"typeParameters": null | ||
} | ||
] | ||
} |
23 changes: 23 additions & 0 deletions
23
...ests/test_programs/should_pass/language/nested_generics/json_abi_oracle_new_encoding.json
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"concreteTypes": [ | ||
{ | ||
"concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", | ||
"type": "bool" | ||
} | ||
], | ||
"configurables": [], | ||
"encodingVersion": "1", | ||
"functions": [ | ||
{ | ||
"attributes": null, | ||
"inputs": [], | ||
"name": "main", | ||
"output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" | ||
} | ||
], | ||
"loggedTypes": [], | ||
"messagesTypes": [], | ||
"metadataTypes": [], | ||
"programType": "script", | ||
"specVersion": "1" | ||
} |
74 changes: 74 additions & 0 deletions
74
test/src/e2e_vm_tests/test_programs/should_pass/language/nested_generics/src/main.sw
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
script; | ||
|
||
enum MyOption<T> { | ||
Some: T, | ||
None: (), | ||
} | ||
|
||
impl<T> MyOption<T> { | ||
fn new() -> Self { | ||
Self::None | ||
} | ||
|
||
fn is_none(self) -> bool { | ||
true | ||
} | ||
} | ||
|
||
fn generic_arg_in_function_method_call<T>() { | ||
let o: MyOption<u64> = MyOption::None; | ||
let _ = o.is_none(); | ||
|
||
let o: MyOption<MyOption<u64>> = MyOption::None; | ||
let _ = o.is_none(); | ||
|
||
let o: MyOption<T> = MyOption::None; | ||
let _ = o.is_none(); | ||
|
||
let o: MyOption<MyOption<T>> = MyOption::None; | ||
let _ = o.is_none(); | ||
|
||
let _ = MyOption::is_none(o); | ||
} | ||
|
||
fn generic_arg_in_function_associated_function_call<T>() { | ||
let _ = MyOption::<u64>::new(); | ||
let o: MyOption<u64> = MyOption::new(); | ||
|
||
let _ = MyOption::<MyOption<u64>>::new(); | ||
let o: MyOption<MyOption<u64>> = MyOption::new(); | ||
|
||
let _ = MyOption::<T>::new(); | ||
let o: MyOption<T> = MyOption::new(); | ||
|
||
let _ = MyOption::<MyOption<T>>::new(); | ||
} | ||
|
||
struct S<T> { } | ||
|
||
impl<T> S<T> { | ||
fn generic_arg_in_type() { | ||
let o: MyOption<u64> = MyOption::None; | ||
let _ = o.is_none(); | ||
|
||
let o: MyOption<MyOption<u64>> = MyOption::None; | ||
let _ = o.is_none(); | ||
|
||
let o: MyOption<T> = MyOption::None; | ||
let _ = o.is_none(); | ||
|
||
let o: MyOption<MyOption<T>> = MyOption::None; | ||
let _ = o.is_none(); | ||
|
||
let _ = MyOption::is_none(o); | ||
} | ||
} | ||
|
||
pub fn main() -> bool { | ||
generic_arg_in_function_method_call::<(())>(); | ||
S::<()>::generic_arg_in_type(); | ||
|
||
generic_arg_in_function_associated_function_call::<()>(); | ||
|
||
true | ||
} |
5 changes: 5 additions & 0 deletions
5
test/src/e2e_vm_tests/test_programs/should_pass/language/nested_generics/test.toml
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
category = "run" | ||
expected_result = { action = "return", value = 1 } | ||
expected_result_new_encoding = { action = "return_data", value = "01" } | ||
validate_abi = true | ||
expected_warnings = 30 |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.