aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/formal
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-05-02 21:56:59 +0800
committerGitHub <noreply@github.com>2018-05-02 21:56:59 +0800
commit8debded7431cb852bd66edc8ebb615cb39f95231 (patch)
tree8cd4db92d6d7b5aa7c31995ff9a5026c4e9312a3 /libsolidity/formal
parent42289b642ff12d9275dedf10c257cfec8295feed (diff)
downloaddexon-solidity-8debded7431cb852bd66edc8ebb615cb39f95231.tar.gz
dexon-solidity-8debded7431cb852bd66edc8ebb615cb39f95231.tar.zst
dexon-solidity-8debded7431cb852bd66edc8ebb615cb39f95231.zip
Revert "BREAKING: Bool variables should not allow arithmetic comparison"
Diffstat (limited to 'libsolidity/formal')
-rw-r--r--libsolidity/formal/SMTChecker.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libsolidity/formal/SMTChecker.cpp b/libsolidity/formal/SMTChecker.cpp
index 7facdf92..c4dee22d 100644
--- a/libsolidity/formal/SMTChecker.cpp
+++ b/libsolidity/formal/SMTChecker.cpp
@@ -472,7 +472,11 @@ void SMTChecker::compareOperation(BinaryOperation const& _op)
solUnimplementedAssert(SSAVariable::isBool(_op.annotation().commonType->category()), "Operation not yet supported");
value = make_shared<smt::Expression>(
op == Token::Equal ? (left == right) :
- /*op == Token::NotEqual*/ (left != right)
+ op == Token::NotEqual ? (left != right) :
+ op == Token::LessThan ? (!left && right) :
+ op == Token::LessThanOrEqual ? (!left || right) :
+ op == Token::GreaterThan ? (left && !right) :
+ /*op == Token::GreaterThanOrEqual*/ (left || !right)
);
}
// TODO: check that other values for op are not possible.