diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 416ac1efc..b6b4ac90d 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)