-
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.
Fully resolve trait constraints call paths.
- Loading branch information
Showing
14 changed files
with
188 additions
and
108 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
29 changes: 0 additions & 29 deletions
29
test/src/e2e_vm_tests/test_programs/should_fail/trait_cannot_find_in_scope_issue/src/main.sw
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
test/src/e2e_vm_tests/test_programs/should_fail/trait_cannot_find_in_scope_issue/test.toml
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions
39
test/src/e2e_vm_tests/test_programs/should_pass/trait_cannot_find_in_scope_issue/src/main.sw
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
script; | ||
|
||
pub mod lib; | ||
pub mod other_lib; | ||
mod trait_impls; | ||
|
||
// Previously this was a `should_fail` test that checked if we emitted an error | ||
// related to the hash trait in sha256 trait constraint not being explicitly imported. | ||
|
||
// After we changed trait constraints paths to be fully resolved, then lookup | ||
// of those types now works transparently even without the trait being imported here. | ||
|
||
// In fact the previous behavior was problematic since a locally defined trait with the | ||
// same name would take precedence, thus making trait constraint type lookups in essen | ||
// dynamically scoped. | ||
|
||
use std::hash::sha256; | ||
|
||
use ::lib::{S, A, function}; | ||
use ::trait_impls::*; | ||
|
||
fn main() { | ||
let _ = sha256(123u8); | ||
|
||
let s = S {}; | ||
s.method_01(0u8); | ||
s.method_02(A {}); | ||
S::associated_function(A {}); | ||
|
||
function(A {}); | ||
|
||
let a = A {}; | ||
|
||
a.trait_method(A {}); | ||
|
||
A::trait_associated_function(A {}); | ||
|
||
function_with_duplicated_trait(A {}); | ||
} |
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
test/src/e2e_vm_tests/test_programs/should_pass/trait_cannot_find_in_scope_issue/test.toml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
category = "compile" | ||
expected_warnings = 10 |