mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix boolean constants.
This commit is contained in:
parent
90fb14f525
commit
95a65dc04c
@ -139,8 +139,13 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr)
|
||||
}
|
||||
else if (arguments.empty())
|
||||
{
|
||||
// We assume it is an integer...
|
||||
return m_context.int_val(n.c_str());
|
||||
if (n == "true")
|
||||
return m_context.bool_val(true);
|
||||
else if (n == "false")
|
||||
return m_context.bool_val(false);
|
||||
else
|
||||
// We assume it is an integer...
|
||||
return m_context.int_val(n.c_str());
|
||||
}
|
||||
|
||||
solAssert(arity.count(n) && arity.at(n) == arguments.size(), "");
|
||||
|
@ -362,18 +362,15 @@ BOOST_AUTO_TEST_CASE(constant_condition)
|
||||
}
|
||||
)";
|
||||
CHECK_WARNING(text, "Condition is always false");
|
||||
// TODO
|
||||
// // a plain literal constant is fine
|
||||
// text = R"(
|
||||
// contract C {
|
||||
// function f(uint x) public pure {
|
||||
// if (true) { revert(); }
|
||||
// }
|
||||
// }
|
||||
// )";
|
||||
// CHECK_SUCCESS_NO_WARNINGS(text);
|
||||
|
||||
// TODO test unreacheable code
|
||||
// a plain literal constant is fine
|
||||
text = R"(
|
||||
contract C {
|
||||
function f(uint) public pure {
|
||||
if (true) { revert(); }
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_SUCCESS_NO_WARNINGS(text);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user