2019-04-30 17:08:02 +00:00
|
|
|
contract C {
|
|
|
|
function f(bool a) public pure returns (bool x) {
|
|
|
|
bool b = a;
|
|
|
|
x = b;
|
|
|
|
require(b);
|
|
|
|
}
|
|
|
|
function fail() public pure returns (bool x) {
|
|
|
|
x = true;
|
|
|
|
require(false);
|
|
|
|
}
|
|
|
|
function succeed() public pure returns (bool x) {
|
|
|
|
x = true;
|
|
|
|
require(true);
|
|
|
|
}
|
|
|
|
function f2(bool a) public pure returns (bool x) {
|
|
|
|
x = a;
|
|
|
|
string memory message;
|
2019-09-11 10:26:31 +00:00
|
|
|
message = "fancy message!";
|
2019-04-30 17:08:02 +00:00
|
|
|
require(a, message);
|
2019-09-11 10:26:31 +00:00
|
|
|
}
|
|
|
|
function f3(bool a) public pure returns (bool x) {
|
|
|
|
x = a;
|
|
|
|
require(a, "msg");
|
|
|
|
}
|
|
|
|
function f4(bool a) public pure returns (bool x) {
|
|
|
|
x = a;
|
|
|
|
string memory message;
|
|
|
|
require(a, message);
|
|
|
|
}
|
2019-04-30 17:08:02 +00:00
|
|
|
}
|
|
|
|
// ====
|
2019-09-11 10:26:31 +00:00
|
|
|
// compileViaYul: also
|
2020-11-21 13:54:16 +00:00
|
|
|
// compileToEwasm: also
|
2019-09-11 10:26:31 +00:00
|
|
|
// EVMVersion: >=byzantium
|
2019-04-30 17:08:02 +00:00
|
|
|
// ----
|
|
|
|
// f(bool): true -> true
|
|
|
|
// f(bool): false -> FAILURE
|
|
|
|
// fail() -> FAILURE
|
|
|
|
// succeed() -> true
|
2019-09-11 10:26:31 +00:00
|
|
|
// f2(bool): true -> true
|
|
|
|
// f2(bool): false -> FAILURE, hex"08c379a0", 0x20, 14, "fancy message!"
|
|
|
|
// f3(bool): true -> true
|
|
|
|
// f3(bool): false -> FAILURE, hex"08c379a0", 0x20, 3, "msg"
|
|
|
|
// f4(bool): true -> true
|
|
|
|
// f4(bool): false -> FAILURE, hex"08c379a0", 0x20, 0
|