1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed conversion of zero-sized array to span

This commit is contained in:
Brian Fiete 2024-11-20 09:26:32 -05:00
parent 6eb1b16aa0
commit 75a5a3695b

View file

@ -14556,8 +14556,15 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
if ((convTypedVal.mType->IsWrappableType()) && (wantType == GetWrappedStructType(convTypedVal.mType)))
{
convTypedVal = MakeAddressable(convTypedVal);
methodMatcher.mArguments[0].mTypedValue = BfTypedValue(mBfIRBuilder->CreateBitCast(convTypedVal.mValue, mBfIRBuilder->MapTypeInstPtr(wantType->ToTypeInstance())),
paramType, paramType->IsRef() ? BfTypedValueKind_Value : BfTypedValueKind_Addr);
if (convTypedVal.mType->IsValuelessType())
{
methodMatcher.mArguments[0].mTypedValue = GetDefaultTypedValue(paramType, false, paramType->IsRef() ? BfDefaultValueKind_Value : BfDefaultValueKind_Addr);
}
else
{
methodMatcher.mArguments[0].mTypedValue = BfTypedValue(mBfIRBuilder->CreateBitCast(convTypedVal.mValue, mBfIRBuilder->MapTypeInstPtr(wantType->ToTypeInstance())),
paramType, paramType->IsRef() ? BfTypedValueKind_Value : BfTypedValueKind_Addr);
}
}
else
{