aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@gmail.com>2015-12-23 23:48:10 +0800
committerLu Guanqun <guanqun.lu@gmail.com>2016-01-23 01:14:00 +0800
commit36a758e224a600d277d683aec8578520e71b8290 (patch)
tree4716e7037e94ae753a611ea8f8727f025da72106 /libsolidity
parent08493589c1638b57721613d46e9e8d28f244f1d3 (diff)
downloaddexon-solidity-36a758e224a600d277d683aec8578520e71b8290.tar.gz
dexon-solidity-36a758e224a600d277d683aec8578520e71b8290.tar.zst
dexon-solidity-36a758e224a600d277d683aec8578520e71b8290.zip
[cond-expr] fix the crash in ExpressionStatement
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp5
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)