mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Revert statement.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
error E(uint a, uint b);
|
||||
contract C {
|
||||
function f(bool c) public pure {
|
||||
require(c, E(2, 7));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9322: (83-90): No matching declaration found after argument-dependent lookup.
|
||||
@@ -0,0 +1,8 @@
|
||||
error E(uint a, uint b);
|
||||
contract C {
|
||||
function f() public pure {
|
||||
revert(E(2, 7));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9322: (77-83): No matching declaration found after argument-dependent lookup.
|
||||
@@ -0,0 +1,3 @@
|
||||
revert X();
|
||||
// ----
|
||||
// ParserError 2314: (8-9): Expected ';' but got '('
|
||||
@@ -0,0 +1,6 @@
|
||||
error E();
|
||||
function f() pure {
|
||||
E();
|
||||
}
|
||||
// ----
|
||||
// TypeError 7757: (35-38): Errors can only be used with revert statements: "revert MyError();".
|
||||
@@ -0,0 +1,4 @@
|
||||
error E();
|
||||
function f() pure {
|
||||
revert E();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
error E();
|
||||
function f() public pure {
|
||||
revert E;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (50-51): Expected '(' but got ';'
|
||||
@@ -0,0 +1,5 @@
|
||||
function f() public pure {
|
||||
revert 1;
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (38-39): Expected ';' but got 'Number'
|
||||
@@ -0,0 +1,6 @@
|
||||
error E();
|
||||
contract C {
|
||||
function f() public pure {
|
||||
revert E();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
event E();
|
||||
function f() public pure {
|
||||
revert E();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 1885: (74-75): Expression has to be an error.
|
||||
@@ -0,0 +1,8 @@
|
||||
error revert();
|
||||
contract C {
|
||||
function f() public pure {
|
||||
revert revert();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2319: (0-15): This declaration shadows a builtin symbol.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract A {
|
||||
error E();
|
||||
}
|
||||
contract C {
|
||||
function f() public pure {
|
||||
revert A.E();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
error f(uint, uint);
|
||||
contract C {
|
||||
function f(uint) public {
|
||||
revert f(10);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2519: (38-91): This declaration shadows an existing declaration.
|
||||
// TypeError 1885: (79-80): Expression has to be an error.
|
||||
@@ -0,0 +1,8 @@
|
||||
struct S { uint x; }
|
||||
contract C {
|
||||
function f() public {
|
||||
revert S(10);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 1885: (75-76): Expression has to be an error.
|
||||
Reference in New Issue
Block a user