mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed on-demand constraint check crash
This commit is contained in:
parent
85279be033
commit
d56af187ca
1 changed files with 16 additions and 1 deletions
|
@ -204,6 +204,10 @@ bool BfModule::ValidateGenericConstraints(BfTypeReference* typeRef, BfTypeInstan
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We don't validate constraints for things like Tuples/Delegates
|
||||||
|
if (genericTypeInst->IsOnDemand())
|
||||||
|
return true;
|
||||||
|
|
||||||
SetAndRestoreValue<bool> prevIgnoreErrors(mIgnoreErrors, mIgnoreErrors || ignoreErrors);
|
SetAndRestoreValue<bool> prevIgnoreErrors(mIgnoreErrors, mIgnoreErrors || ignoreErrors);
|
||||||
genericTypeInst->mGenericTypeInfo->mValidatedGenericConstraints = true;
|
genericTypeInst->mGenericTypeInfo->mValidatedGenericConstraints = true;
|
||||||
|
|
||||||
|
@ -8851,7 +8855,12 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matches)
|
if (matches)
|
||||||
|
{
|
||||||
|
typedVal = MakeAddressable(typedVal);
|
||||||
|
if (resultFlags != NULL)
|
||||||
|
*resultFlags = (BfCastResultFlags)(BfCastResultFlags_IsAddr);
|
||||||
return mBfIRBuilder->CreateBitCast(typedVal.mValue, mBfIRBuilder->MapType(toType));
|
return mBfIRBuilder->CreateBitCast(typedVal.mValue, mBfIRBuilder->MapType(toType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10252,6 +10261,12 @@ BfTypedValue BfModule::Cast(BfAstNode* srcNode, const BfTypedValue& typedVal, Bf
|
||||||
{
|
{
|
||||||
return BfTypedValue(mBfIRBuilder->CreateBitCast(typedVal.mValue, mBfIRBuilder->MapTypeInstPtr(tupleType)), tupleType, BfTypedValueKind_ReadOnlyAddr);
|
return BfTypedValue(mBfIRBuilder->CreateBitCast(typedVal.mValue, mBfIRBuilder->MapTypeInstPtr(tupleType)), tupleType, BfTypedValueKind_ReadOnlyAddr);
|
||||||
}
|
}
|
||||||
|
else if (typedVal.IsSplat())
|
||||||
|
{
|
||||||
|
BfTypedValue retTypedValue = typedVal;
|
||||||
|
retTypedValue.mType = tupleType;
|
||||||
|
return retTypedValue;
|
||||||
|
}
|
||||||
|
|
||||||
BfIRValue curTupleValue = CreateAlloca(tupleType);
|
BfIRValue curTupleValue = CreateAlloca(tupleType);
|
||||||
auto loadedVal = LoadValue(typedVal);
|
auto loadedVal = LoadValue(typedVal);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue