-
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.
Fixes ContractCaller type propagation. (#6662)
## Description ContractCaller comparison was too restrictive, we now just check if the span matches. This fixes unification of codeblock first pass variables with second pass variables. Fixes [#6614](#6614) ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. Co-authored-by: João Matos <joao@tritao.eu>
- Loading branch information
Showing
6 changed files
with
51 additions
and
6 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
13 changes: 13 additions & 0 deletions
13
test/src/e2e_vm_tests/test_programs/should_pass/language/abi_cast_nested_method/Forc.lock
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,13 @@ | ||
[[package]] | ||
name = "abi_cast_nested_method" | ||
source = "member" | ||
dependencies = ["std"] | ||
|
||
[[package]] | ||
name = "core" | ||
source = "path+from-root-0D81C4DB888BC505" | ||
|
||
[[package]] | ||
name = "std" | ||
source = "path+from-root-0D81C4DB888BC505" | ||
dependencies = ["core"] |
9 changes: 9 additions & 0 deletions
9
test/src/e2e_vm_tests/test_programs/should_pass/language/abi_cast_nested_method/Forc.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,9 @@ | ||
[project] | ||
authors = ["Fuel Labs <contact@fuel.sh>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "abi_cast_nested_method" | ||
implicit-std = false | ||
|
||
[dependencies] | ||
std = { path = "../../../../../../../sway-lib-std" } |
21 changes: 21 additions & 0 deletions
21
test/src/e2e_vm_tests/test_programs/should_pass/language/abi_cast_nested_method/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,21 @@ | ||
script; | ||
|
||
abi AMM { | ||
fn pool() -> Option<ContractId>; | ||
} | ||
abi Exchange { | ||
fn swap_exact_output(); | ||
} | ||
|
||
fn main() { | ||
let amm_contract = abi(AMM, 0x0000000000000000000000000000000000000000000000000000000000000000); | ||
|
||
let exchange_contract_id = amm_contract.pool(); | ||
|
||
// let a = exchange_contract_id.unwrap().into(); | ||
// let exchange_contract = abi(Exchange, a); | ||
|
||
let exchange_contract = abi(Exchange, exchange_contract_id.unwrap().into()); | ||
|
||
exchange_contract.swap_exact_output(); | ||
} |
2 changes: 2 additions & 0 deletions
2
test/src/e2e_vm_tests/test_programs/should_pass/language/abi_cast_nested_method/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 = 0 |