-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
281 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
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
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
24 changes: 24 additions & 0 deletions
24
test/libsolidity/semanticTests/errors/error_in_library_and_interface.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 @@ | ||
error E(uint a); | ||
library L { | ||
error E(uint a, uint b); | ||
} | ||
interface I { | ||
error E(uint a, uint b, uint c); | ||
} | ||
contract C { | ||
function f() public pure { | ||
revert E(1); | ||
} | ||
function g() public pure { | ||
revert L.E(1, 2); | ||
} | ||
function h() public pure { | ||
revert I.E(1, 2, 3); | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// f() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" | ||
// g() -> FAILURE, hex"85208890", hex"0000000000000000000000000000000000000000000000000000000000000001", hex"0000000000000000000000000000000000000000000000000000000000000002" | ||
// h() -> FAILURE, hex"7924ea7c", hex"0000000000000000000000000000000000000000000000000000000000000001", hex"0000000000000000000000000000000000000000000000000000000000000002", hex"0000000000000000000000000000000000000000000000000000000000000003" |
10 changes: 10 additions & 0 deletions
10
test/libsolidity/semanticTests/errors/named_error_args.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,10 @@ | ||
error E(uint a, uint b); | ||
contract C { | ||
function f() public pure { | ||
revert E({b: 7, a: 2}); | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// f() -> FAILURE, hex"85208890", hex"0000000000000000000000000000000000000000000000000000000000000002", hex"0000000000000000000000000000000000000000000000000000000000000007" |
13 changes: 13 additions & 0 deletions
13
test/libsolidity/semanticTests/errors/panic_via_import.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,13 @@ | ||
==== Source: s1.sol ==== | ||
error E(uint); | ||
==== Source: s2.sol ==== | ||
import { E as Panic } from "s1.sol"; | ||
contract C { | ||
function a() public pure { | ||
revert Panic(1); | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// a() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" |
12 changes: 12 additions & 0 deletions
12
test/libsolidity/semanticTests/errors/revert_conversion.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,12 @@ | ||
error E(string a, uint[] b); | ||
contract C { | ||
uint[] x; | ||
function f() public { | ||
x.push(7); | ||
revert E("abc", x); | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// f() -> FAILURE, hex"59e4d4df", 0x40, 0x80, 3, "abc", 1, 7 |
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,10 @@ | ||
error E(uint a, uint b); | ||
contract C { | ||
function f() public pure { | ||
revert E(2, 7); | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// f() -> FAILURE, hex"85208890", 2, 7 |
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,16 @@ | ||
pragma abicoder v2; | ||
struct S { uint a; string b; } | ||
error E(uint a, S, uint b); | ||
contract C { | ||
S s; | ||
function f(bool c) public { | ||
s.a = 9; | ||
s.b = "abc"; | ||
revert E(2, s, 7); | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// f(bool): true -> FAILURE, hex"e96e07f0", hex"0000000000000000000000000000000000000000000000000000000000000002", hex"0000000000000000000000000000000000000000000000000000000000000060", hex"0000000000000000000000000000000000000000000000000000000000000007", hex"0000000000000000000000000000000000000000000000000000000000000009", hex"0000000000000000000000000000000000000000000000000000000000000040", hex"0000000000000000000000000000000000000000000000000000000000000003", hex"6162630000000000000000000000000000000000000000000000000000000000" | ||
// f(bool): false -> FAILURE, hex"e96e07f0", hex"0000000000000000000000000000000000000000000000000000000000000002", hex"0000000000000000000000000000000000000000000000000000000000000060", hex"0000000000000000000000000000000000000000000000000000000000000007", hex"0000000000000000000000000000000000000000000000000000000000000009", hex"0000000000000000000000000000000000000000000000000000000000000040", hex"0000000000000000000000000000000000000000000000000000000000000003", hex"6162630000000000000000000000000000000000000000000000000000000000" |
18 changes: 18 additions & 0 deletions
18
test/libsolidity/semanticTests/errors/via_contract_type.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,18 @@ | ||
contract A { | ||
error E(uint); | ||
} | ||
contract X { | ||
error E(string); | ||
} | ||
contract B is A { | ||
function f() public pure { revert E(1); } | ||
function g() public pure { revert A.E(1); } | ||
function h() public pure { revert X.E("abc"); } | ||
|
||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// f() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" | ||
// g() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" | ||
// h() -> FAILURE, hex"3e9992c9", hex"0000000000000000000000000000000000000000000000000000000000000020", hex"0000000000000000000000000000000000000000000000000000000000000003", hex"6162630000000000000000000000000000000000000000000000000000000000" |
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,25 @@ | ||
==== Source: s1.sol ==== | ||
error E(uint); | ||
==== Source: s2.sol ==== | ||
import "s1.sol" as S; | ||
==== Source: s3.sol ==== | ||
import "s1.sol" as S; | ||
import "s2.sol" as T; | ||
import "s1.sol"; | ||
contract C { | ||
function x() public pure { | ||
revert E(1); | ||
} | ||
function y() public pure { | ||
revert S.E(2); | ||
} | ||
function z() public pure { | ||
revert T.S.E(3); | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// x() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" | ||
// y() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000002" | ||
// z() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000003" |
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,10 @@ | ||
error error(uint a); | ||
contract C { | ||
function f() public pure { | ||
revert error(2); | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: also | ||
// ---- | ||
// f() -> FAILURE, hex"b48fb6cf", hex"0000000000000000000000000000000000000000000000000000000000000002" |