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.
Add preliminary support for
super
resolution
- Loading branch information
Showing
15 changed files
with
577 additions
and
2 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
34 changes: 33 additions & 1 deletion
34
...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.
5 changes: 5 additions & 0 deletions
5
crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/contracts.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_output/generated/contracts.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
crates/solidity/testing/snapshots/bindings_assertions/contracts/virtual_methods.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,40 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
contract A { | ||
// ^def:dummy -- to have at least one assertion in 0.4.11 | ||
function foo() public pure virtual returns (string memory) { | ||
// ^def:1 | ||
return "A"; | ||
} | ||
} | ||
|
||
contract B is A { | ||
function foo() public pure virtual override returns (string memory) { | ||
// ^def:2 | ||
return "B"; | ||
} | ||
} | ||
|
||
contract C is A { | ||
function foo() public pure virtual override returns (string memory) { | ||
// ^def:3 | ||
return "C"; | ||
} | ||
} | ||
|
||
contract D is B, C { | ||
// D.foo() returns "C" | ||
function foo() public pure override(B, C) returns (string memory) { | ||
return super.foo(); | ||
// ^ref:3 (>=0.6.0) | ||
} | ||
} | ||
|
||
contract E is C, B { | ||
// E.foo() returns "B" | ||
function foo() public pure override(C, B) returns (string memory) { | ||
return super.foo(); | ||
// ^ref:2 (>=0.6.0) | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...dity/testing/snapshots/bindings_output/contracts/super_scope/generated/0.4.11-failure.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,41 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Parse errors: | ||
Error: Expected OpenBrace or ReturnsKeyword or Semicolon. | ||
╭─[input.sol:5:27] | ||
│ | ||
5 │ ╭─▶ function foo() public pure virtual returns (string memory) { | ||
┆ ┆ | ||
7 │ ├─▶ } | ||
│ │ | ||
│ ╰─────────── Error occurred here. | ||
───╯ | ||
Error: Expected OpenBrace or ReturnsKeyword or Semicolon. | ||
╭─[input.sol:12:27] | ||
│ | ||
12 │ ╭─▶ function foo() public pure virtual override(A) returns (string memory) { | ||
┆ ┆ | ||
14 │ ├─▶ } | ||
│ │ | ||
│ ╰─────────── Error occurred here. | ||
────╯ | ||
References and definitions: | ||
╭─[input.sol:1:1] | ||
│ | ||
4 │ contract A { | ||
│ ┬ | ||
│ ╰── def: 1 | ||
5 │ function foo() public pure virtual returns (string memory) { | ||
│ ─┬─ | ||
│ ╰─── def: 2 | ||
│ | ||
10 │ contract B is A { | ||
│ ┬ ┬ | ||
│ ╰─────── def: 3 | ||
│ │ | ||
│ ╰── ref: 1 | ||
│ | ||
12 │ function foo() public pure virtual override(A) returns (string memory) { | ||
│ ─┬─ | ||
│ ╰─── def: 4 | ||
────╯ |
35 changes: 35 additions & 0 deletions
35
...dity/testing/snapshots/bindings_output/contracts/super_scope/generated/0.4.16-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,35 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
References and definitions: | ||
╭─[input.sol:1:1] | ||
│ | ||
4 │ contract A { | ||
│ ┬ | ||
│ ╰── def: 1 | ||
5 │ function foo() public pure virtual returns (string memory) { | ||
│ ─┬─ ───┬─── | ||
│ ╰───────────────────────── def: 2 | ||
│ │ | ||
│ ╰───── unresolved | ||
│ | ||
10 │ contract B is A { | ||
│ ┬ ┬ | ||
│ ╰─────── def: 3 | ||
│ │ | ||
│ ╰── ref: 1 | ||
│ | ||
12 │ function foo() public pure virtual override(A) returns (string memory) { | ||
│ ─┬─ ───┬─── ────┬─── ┬ | ||
│ ╰──────────────────────────────────── def: 4 | ||
│ │ │ │ | ||
│ ╰──────────────── unresolved | ||
│ │ │ | ||
│ ╰─────── unresolved | ||
│ │ | ||
│ ╰── unresolved | ||
13 │ return super.foo(); | ||
│ ──┬── ─┬─ | ||
│ ╰──────── unresolved | ||
│ │ | ||
│ ╰─── ref: 2 | ||
────╯ |
36 changes: 36 additions & 0 deletions
36
...idity/testing/snapshots/bindings_output/contracts/super_scope/generated/0.5.0-failure.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,36 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Parse errors: | ||
Error: Expected OpenBrace or ReturnsKeyword or Semicolon. | ||
╭─[input.sol:12:40] | ||
│ | ||
12 │ ╭─▶ function foo() public pure virtual override(A) returns (string memory) { | ||
┆ ┆ | ||
14 │ ├─▶ } | ||
│ │ | ||
│ ╰─────────── Error occurred here. | ||
────╯ | ||
References and definitions: | ||
╭─[input.sol:1:1] | ||
│ | ||
4 │ contract A { | ||
│ ┬ | ||
│ ╰── def: 1 | ||
5 │ function foo() public pure virtual returns (string memory) { | ||
│ ─┬─ ───┬─── | ||
│ ╰───────────────────────── def: 2 | ||
│ │ | ||
│ ╰───── unresolved | ||
│ | ||
10 │ contract B is A { | ||
│ ┬ ┬ | ||
│ ╰─────── def: 3 | ||
│ │ | ||
│ ╰── ref: 1 | ||
│ | ||
12 │ function foo() public pure virtual override(A) returns (string memory) { | ||
│ ─┬─ ───┬─── | ||
│ ╰───────────────────────── def: 4 | ||
│ │ | ||
│ ╰───── unresolved | ||
────╯ |
29 changes: 29 additions & 0 deletions
29
...idity/testing/snapshots/bindings_output/contracts/super_scope/generated/0.6.0-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,29 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
References and definitions: | ||
╭─[input.sol:1:1] | ||
│ | ||
4 │ contract A { | ||
│ ┬ | ||
│ ╰── def: 1 | ||
5 │ function foo() public pure virtual returns (string memory) { | ||
│ ─┬─ | ||
│ ╰─── def: 2 | ||
│ | ||
10 │ contract B is A { | ||
│ ┬ ┬ | ||
│ ╰─────── def: 3 | ||
│ │ | ||
│ ╰── ref: 1 | ||
│ | ||
12 │ function foo() public pure virtual override(A) returns (string memory) { | ||
│ ─┬─ ┬ | ||
│ ╰──────────────────────────────────── def: 4 | ||
│ │ | ||
│ ╰── ref: 1 | ||
13 │ return super.foo(); | ||
│ ──┬── ─┬─ | ||
│ ╰──────── unresolved | ||
│ │ | ||
│ ╰─── ref: 2 | ||
────╯ |
15 changes: 15 additions & 0 deletions
15
crates/solidity/testing/snapshots/bindings_output/contracts/super_scope/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,15 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
contract A { | ||
function foo() public pure virtual returns (string memory) { | ||
return "A"; | ||
} | ||
} | ||
|
||
contract B is A { | ||
// A super; | ||
function foo() public pure virtual override(A) returns (string memory) { | ||
return super.foo(); | ||
} | ||
} |
Oops, something went wrong.