diff options
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 8f1b2b9d..b4896b49 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -754,8 +754,12 @@ bool TypeChecker::visit(Conditional const& _conditional) TypePointer const& trueType = type(_conditional.trueExpression()); TypePointer const& falseType = type(_conditional.falseExpression()); - // we fake it as an equal operator, but any other comparison operator can work. - TypePointer commonType = trueType->binaryOperatorResult(Token::Equal, falseType); + TypePointer commonType; + if (*trueType == *falseType) + commonType = trueType; + else + // we fake it as an equal operator, but any other comparison operator can work. + TypePointer commonType = trueType->binaryOperatorResult(Token::Equal, falseType); if (!commonType) { typeError( |