-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
Adds binding rules in Solidity for: - function modifiers (pending virtual/override lookups) - type resolution in custom errors and events - function calls with named parameters - `emit`/`revert` with named parameters - call options (for external calls) - fallback and receive functions - `new` expressions - type resolution for function calls and `new` expressions
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
contract Test { | ||
enum Cause { InsuficientFunds, NotAuthorized, InvalidDate } | ||
// ^def:3 | ||
error Failure ( | ||
Cause cause, | ||
// ^def:1 | ||
string details | ||
// ^def:2 | ||
); | ||
function test() public { | ||
revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); | ||
// ^ref:1 (>= 0.8.4) | ||
// ^ref:3 (>= 0.8.4) | ||
// ^ref:2 (>= 0.8.4) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
contract Test { | ||
enum Cause { | ||
//^def:1 | ||
InsuficientFunds, | ||
NotAuthorized, | ||
//<def:2 | ||
InvalidDate | ||
} | ||
error Failure ( | ||
//^def:3 | ||
Cause cause, | ||
//<ref:1 | ||
string details | ||
); | ||
function test() public { | ||
revert Failure(Cause.NotAuthorized, "not owner"); | ||
// ^ref:2 (>= 0.8.4) | ||
// ^ref:1 (>= 0.8.4) | ||
// ^ref:3 (>= 0.8.4) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
contract Test { | ||
enum Severity { Info, Error } | ||
// ^def:3 | ||
|
||
event Log ( | ||
Severity level, | ||
// ^def:1 | ||
string message | ||
// ^def:2 | ||
); | ||
|
||
function test() { | ||
emit Log({message: "testing", level: Severity.Info}); | ||
// ^ref:3 (>= 0.4.21) | ||
// ^ref:1 (>= 0.4.21) | ||
// ^ref:2 (>= 0.4.21) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
contract Test { | ||
enum Severity { | ||
//^def:1 | ||
Info, | ||
//<def:3 | ||
Error | ||
} | ||
|
||
event Log ( | ||
//^def:2 | ||
Severity level, | ||
//<ref:1 | ||
string message | ||
); | ||
|
||
function test() { | ||
emit Log(Severity.Info, "testing"); | ||
// ^ref:3 (>= 0.4.21) | ||
// ^ref:1 (>= 0.4.21) | ||
// ^ref:2 (>= 0.4.21) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
interface External { | ||
function sample(uint x) external payable returns (uint); | ||
// ^def:5 | ||
} | ||
|
||
contract Test { | ||
External ext; | ||
// ^def:4 | ||
function test(uint x) public returns (uint) { | ||
// ^def:1 | ||
uint v = 10; | ||
// ^def:2 | ||
uint g = 800; | ||
// ^def:3 | ||
|
||
return ext.sample{ value: v, gas: g }(x); | ||
// ^ref:1 (>= 0.6.2) | ||
// ^ref:3 (>= 0.6.2) | ||
// ^ref:2 (>= 0.6.2) | ||
// ^ref:5 | ||
// ^ref:4 | ||
} | ||
} |
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); | ||
} | ||
} |
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 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Parse errors: | ||
Error: Expected ConstantKeyword or Identifier or InternalKeyword or PrivateKeyword or PublicKeyword. | ||
╭─[input.sol:5:13] | ||
│ | ||
5 │ ╭─▶ fallback(bytes calldata input) external payable returns (bytes memory output) { | ||
┆ ┆ | ||
12 │ ├─▶ } | ||
│ │ | ||
│ ╰─────────── Error occurred here. | ||
────╯ | ||
References and definitions: | ||
╭─[input.sol:1:1] | ||
│ | ||
1 │ contract Fallback { | ||
│ ────┬─── | ||
│ ╰───── def: 1 | ||
2 │ event Log(string func, uint256 gas); | ||
│ ─┬─ ──┬─ ─┬─ | ||
│ ╰──────────────────────────── def: 2 | ||
│ │ │ | ||
│ ╰──────────────── def: 3 | ||
│ │ | ||
│ ╰─── def: 4 | ||
3 │ uint status; | ||
│ ───┬── | ||
│ ╰──── def: 5 | ||
│ | ||
5 │ fallback(bytes calldata input) external payable returns (bytes memory output) { | ||
│ ────┬─── | ||
│ ╰───── unresolved | ||
───╯ |