forked from NomicFoundation/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve output types in function calls and new expressions
- Loading branch information
Showing
8 changed files
with
218 additions
and
34 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
56 changes: 39 additions & 17 deletions
56
...s/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/expressions.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
crates/solidity/outputs/cargo/tests/src/bindings_output/generated/expressions.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
crates/solidity/testing/snapshots/bindings_assertions/expressions/call_output.sol
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,17 @@ | ||
contract Test { | ||
struct Resource { | ||
uint value; | ||
// ^def:1 | ||
} | ||
|
||
function test_call_output() public returns (uint) { | ||
return get_resource().value; | ||
// ^ref:1 | ||
// ^ref:2 | ||
} | ||
|
||
function get_resource() internal returns (Resource memory) { | ||
// ^def:2 | ||
return Resource(1); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
crates/solidity/testing/snapshots/bindings_assertions/expressions/new_output.sol
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,19 @@ | ||
contract Test { | ||
function test_new_output() public returns (uint) { | ||
return new Container().cell().value; | ||
// ^ref:2 | ||
// ^ref:3 | ||
// ^ref:1 | ||
} | ||
} | ||
|
||
contract Container { | ||
// ^def:1 | ||
struct Resource { | ||
uint value; | ||
// ^def:2 | ||
} | ||
|
||
function cell() public returns (Resource memory) { return Resource(1); } | ||
// ^def:3 | ||
} |
65 changes: 65 additions & 0 deletions
65
...lidity/testing/snapshots/bindings_output/expressions/outputs/generated/0.4.11-success.txt
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,65 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
References and definitions: | ||
╭─[input.sol:1:1] | ||
│ | ||
1 │ contract Test { | ||
│ ──┬─ | ||
│ ╰─── def: 1 | ||
2 │ function test_new() public returns (uint) { | ||
│ ────┬─── | ||
│ ╰───── def: 2 | ||
3 │ return new Container().cell().value; | ||
│ ────┬──── ──┬─ ──┬── | ||
│ ╰───────────────────── ref: 4 | ||
│ │ │ | ||
│ ╰─────────── ref: 5 | ||
│ │ | ||
│ ╰──── ref: 8 | ||
│ | ||
5 │ function test_call() public returns (uint) { | ||
│ ────┬──── | ||
│ ╰────── def: 3 | ||
6 │ return Utils.create().value; | ||
│ ──┬── ───┬── ──┬── | ||
│ ╰─────────────────── ref: 6 | ||
│ │ │ | ||
│ ╰──────────── ref: 9 | ||
│ │ | ||
│ ╰──── ref: 8 | ||
│ | ||
10 │ contract Container { | ||
│ ────┬──── | ||
│ ╰────── def: 4 | ||
11 │ function cell() public returns (Utils.Resource memory) { | ||
│ ──┬─ ──┬── ────┬─── | ||
│ ╰──────────────────────────────────── def: 5 | ||
│ │ │ | ||
│ ╰───────────── ref: 6 | ||
│ │ | ||
│ ╰───── ref: 7 | ||
12 │ return Utils.create(); | ||
│ ──┬── ───┬── | ||
│ ╰─────────── ref: 6 | ||
│ │ | ||
│ ╰──── ref: 9 | ||
│ | ||
16 │ library Utils { | ||
│ ──┬── | ||
│ ╰──── def: 6 | ||
17 │ struct Resource { | ||
│ ────┬─── | ||
│ ╰───── def: 7 | ||
18 │ uint value; | ||
│ ──┬── | ||
│ ╰──── def: 8 | ||
│ | ||
21 │ function create() public returns (Resource memory) { | ||
│ ───┬── ────┬─── | ||
│ ╰─────────────────────────────── def: 9 | ||
│ │ | ||
│ ╰───── ref: 7 | ||
22 │ return Resource(1); | ||
│ ────┬─── | ||
│ ╰───── ref: 7 | ||
────╯ |
24 changes: 24 additions & 0 deletions
24
crates/solidity/testing/snapshots/bindings_output/expressions/outputs/input.sol
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,24 @@ | ||
contract Test { | ||
function test_new() public returns (uint) { | ||
return new Container().cell().value; | ||
} | ||
function test_call() public returns (uint) { | ||
return Utils.create().value; | ||
} | ||
} | ||
|
||
contract Container { | ||
function cell() public returns (Utils.Resource memory) { | ||
return Utils.create(); | ||
} | ||
} | ||
|
||
library Utils { | ||
struct Resource { | ||
uint value; | ||
} | ||
|
||
function create() public returns (Resource memory) { | ||
return Resource(1); | ||
} | ||
} |