mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Fixed accidental const binary op resolution in generic constraint check
This commit is contained in:
parent
864b9252ea
commit
6f35d484b1
2 changed files with 12 additions and 0 deletions
|
@ -3410,6 +3410,16 @@ bool BfExprEvaluator::IsComptimeEntry()
|
|||
return ((mBfEvalExprFlags & BfEvalExprFlags_Comptime) != 0);
|
||||
}
|
||||
|
||||
void BfExprEvaluator::EnsureResultNotConstant()
|
||||
{
|
||||
if ((mResult.mValue.IsConst()) && (!mResult.mType->IsValuelessType()))
|
||||
{
|
||||
auto newTypedValue = mModule->GetDefaultTypedValue(mResult.mType, true, Beefy::BfDefaultValueKind_Addr);
|
||||
mModule->mBfIRBuilder->CreateStore(mResult.mValue, newTypedValue.mValue);
|
||||
mResult = newTypedValue;
|
||||
}
|
||||
}
|
||||
|
||||
int BfExprEvaluator::GetStructRetIdx(BfMethodInstance* methodInstance, bool forceStatic)
|
||||
{
|
||||
if (IsComptime())
|
||||
|
@ -25374,6 +25384,7 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
|||
if (needNewCheck)
|
||||
{
|
||||
PerformBinaryOperation(leftExpression, rightExpression, binaryOp, opToken, flags, newLeftValue, newRightValue);
|
||||
EnsureResultNotConstant();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -458,6 +458,7 @@ public:
|
|||
bool IsComptime();
|
||||
bool IsConstEval();
|
||||
bool IsComptimeEntry();
|
||||
void EnsureResultNotConstant();
|
||||
int GetStructRetIdx(BfMethodInstance* methodInstance, bool forceStatic = false);
|
||||
BfTypedValue SetupNullConditional(BfTypedValue target, BfTokenNode* dotToken);
|
||||
void Evaluate(BfAstNode* astNode, bool propogateNullConditional = false, bool ignoreNullConditional = false, bool allowSplat = true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue