1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

Better undef handling of values initialized from const generic param

This commit is contained in:
Brian Fiete 2020-12-29 17:42:32 -08:00
parent 56c250f251
commit a99a23f79a
2 changed files with 1 additions and 6 deletions

View file

@ -1467,11 +1467,6 @@ BfTypedValue BfModule::GetDefaultTypedValue(BfType* type, bool allowRef, BfDefau
if (defaultValueKind == BfDefaultValueKind_Undef) if (defaultValueKind == BfDefaultValueKind_Undef)
{ {
// auto primType = type->ToPrimitiveType();
// if (primType != NULL)
// {
// return BfTypedValue(mBfIRBuilder->GetUndefConstValue( primType), type);
// }
return BfTypedValue(mBfIRBuilder->GetUndefConstValue(mBfIRBuilder->MapType(type)), type); return BfTypedValue(mBfIRBuilder->GetUndefConstValue(mBfIRBuilder->MapType(type)), type);
} }

View file

@ -10044,7 +10044,7 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
BfTypedValue fromTypedValue; BfTypedValue fromTypedValue;
if (typedVal.mKind == BfTypedValueKind_GenericConstValue) if (typedVal.mKind == BfTypedValueKind_GenericConstValue)
fromTypedValue = GetDefaultTypedValue(genericParamInst->mTypeConstraint); fromTypedValue = GetDefaultTypedValue(genericParamInst->mTypeConstraint, false, BfDefaultValueKind_Undef);
else else
fromTypedValue = BfTypedValue(mBfIRBuilder->GetFakeVal(), genericParamInst->mTypeConstraint, genericParamInst->mTypeConstraint->IsValueType()); fromTypedValue = BfTypedValue(mBfIRBuilder->GetFakeVal(), genericParamInst->mTypeConstraint, genericParamInst->mTypeConstraint->IsValueType());