mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48: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);
|
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)
|
int BfExprEvaluator::GetStructRetIdx(BfMethodInstance* methodInstance, bool forceStatic)
|
||||||
{
|
{
|
||||||
if (IsComptime())
|
if (IsComptime())
|
||||||
|
@ -25374,6 +25384,7 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
||||||
if (needNewCheck)
|
if (needNewCheck)
|
||||||
{
|
{
|
||||||
PerformBinaryOperation(leftExpression, rightExpression, binaryOp, opToken, flags, newLeftValue, newRightValue);
|
PerformBinaryOperation(leftExpression, rightExpression, binaryOp, opToken, flags, newLeftValue, newRightValue);
|
||||||
|
EnsureResultNotConstant();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,6 +458,7 @@ public:
|
||||||
bool IsComptime();
|
bool IsComptime();
|
||||||
bool IsConstEval();
|
bool IsConstEval();
|
||||||
bool IsComptimeEntry();
|
bool IsComptimeEntry();
|
||||||
|
void EnsureResultNotConstant();
|
||||||
int GetStructRetIdx(BfMethodInstance* methodInstance, bool forceStatic = false);
|
int GetStructRetIdx(BfMethodInstance* methodInstance, bool forceStatic = false);
|
||||||
BfTypedValue SetupNullConditional(BfTypedValue target, BfTokenNode* dotToken);
|
BfTypedValue SetupNullConditional(BfTypedValue target, BfTokenNode* dotToken);
|
||||||
void Evaluate(BfAstNode* astNode, bool propogateNullConditional = false, bool ignoreNullConditional = false, bool allowSplat = true);
|
void Evaluate(BfAstNode* astNode, bool propogateNullConditional = false, bool ignoreNullConditional = false, bool allowSplat = true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue