mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[cond-expr] fix the crash in ExpressionStatement
This commit is contained in:
parent
08493589c1
commit
36a758e224
@ -760,6 +760,7 @@ void TypeChecker::endVisit(Conditional const& _conditional)
|
|||||||
// we fake it as an equal operator, but any other comparison operator can work.
|
// we fake it as an equal operator, but any other comparison operator can work.
|
||||||
TypePointer commonType = trueType->binaryOperatorResult(Token::Equal, falseType);
|
TypePointer commonType = trueType->binaryOperatorResult(Token::Equal, falseType);
|
||||||
if (!commonType)
|
if (!commonType)
|
||||||
|
{
|
||||||
typeError(
|
typeError(
|
||||||
_conditional.location(),
|
_conditional.location(),
|
||||||
"True expression's type " +
|
"True expression's type " +
|
||||||
@ -768,6 +769,10 @@ void TypeChecker::endVisit(Conditional const& _conditional)
|
|||||||
falseType->toString() +
|
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;
|
_conditional.annotation().type = commonType;
|
||||||
|
|
||||||
if (_conditional.annotation().lValueRequested)
|
if (_conditional.annotation().lValueRequested)
|
||||||
|
Loading…
Reference in New Issue
Block a user