diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2015-12-23 23:48:10 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2016-01-23 01:14:00 +0800 |
commit | 36a758e224a600d277d683aec8578520e71b8290 (patch) | |
tree | 4716e7037e94ae753a611ea8f8727f025da72106 /libsolidity/analysis/TypeChecker.cpp | |
parent | 08493589c1638b57721613d46e9e8d28f244f1d3 (diff) | |
download | dexon-solidity-36a758e224a600d277d683aec8578520e71b8290.tar dexon-solidity-36a758e224a600d277d683aec8578520e71b8290.tar.gz dexon-solidity-36a758e224a600d277d683aec8578520e71b8290.tar.bz2 dexon-solidity-36a758e224a600d277d683aec8578520e71b8290.tar.lz dexon-solidity-36a758e224a600d277d683aec8578520e71b8290.tar.xz dexon-solidity-36a758e224a600d277d683aec8578520e71b8290.tar.zst dexon-solidity-36a758e224a600d277d683aec8578520e71b8290.zip |
[cond-expr] fix the crash in ExpressionStatement
Diffstat (limited to 'libsolidity/analysis/TypeChecker.cpp')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 416ac1ef..b6b4ac90 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -760,6 +760,7 @@ void TypeChecker::endVisit(Conditional const& _conditional) // we fake it as an equal operator, but any other comparison operator can work. TypePointer commonType = trueType->binaryOperatorResult(Token::Equal, falseType); if (!commonType) + { typeError( _conditional.location(), "True expression's type " + @@ -768,6 +769,10 @@ void TypeChecker::endVisit(Conditional const& _conditional) falseType->toString() + "." ); + // even we can't find a common type, we have to set a type here, + // otherwise the upper statement will not be able to check the type. + commonType = trueType; + } _conditional.annotation().type = commonType; if (_conditional.annotation().lValueRequested) |