[cond-expr] change the end to end test

This commit is contained in:
Lu Guanqun
2016-01-22 17:14:01 +00:00
parent ac3019298a
commit c8b0533933
2 changed files with 11 additions and 6 deletions
+6 -2
View File
@@ -758,8 +758,12 @@ bool TypeChecker::visit(Conditional const& _conditional)
if (*trueType == *falseType)
commonType = trueType;
else
// we fake it as an equal operator, but any other comparison operator can work.
commonType = trueType->binaryOperatorResult(Token::Equal, falseType);
{
commonType = Type::commonType(trueType, falseType);
if (!commonType)
// we fake it as an equal operator, but any other comparison operator can work.
commonType = trueType->binaryOperatorResult(Token::Equal, falseType);
}
if (!commonType)
{
typeError(