1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed ternary operator with literals without expected type

This commit is contained in:
Brian Fiete 2020-08-30 10:06:17 -07:00
parent 16e6097dad
commit 705c739750

View file

@ -15703,6 +15703,7 @@ void BfExprEvaluator::Visit(BfConditionalExpression* condExpr)
auto checkTrueValue = mModule->Cast(condExpr->mTrueExpression, trueValue, mExpectingType, BfCastFlags_SilentFail);
if (checkTrueValue)
trueValue = checkTrueValue;
mModule->FixIntUnknown(trueValue);
}
auto trueBlockPos = mModule->mBfIRBuilder->GetInsertBlock();
@ -15714,6 +15715,7 @@ void BfExprEvaluator::Visit(BfConditionalExpression* condExpr)
auto checkFalseValue = mModule->Cast(condExpr->mFalseExpression, falseValue, mExpectingType, BfCastFlags_SilentFail);
if (checkFalseValue)
falseValue = checkFalseValue;
mModule->FixIntUnknown(falseValue);
}
bool isValid = trueValue && falseValue;