1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed crash during attempt to derive from 'Base[Value]'

This commit is contained in:
Brian Fiete 2020-04-28 04:55:49 -07:00
parent 966b886fcc
commit da29d695dd
3 changed files with 12 additions and 3 deletions

View file

@ -1614,7 +1614,7 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
if (typeDef->mIsCombinedPartial)
declTypeDef = typeDef->mPartials.front();
SetAndRestoreValue<BfTypeDef*> prevTypeDef(mContext->mCurTypeState->mCurTypeDef, declTypeDef);
SetAndRestoreValue<BfTypeDefineState> prevDefineState(typeInstance->mDefineState, BfTypeDefineState_ResolvingBaseType);
SetAndRestoreValue<BfTypeReference*> prevTypeRef(mContext->mCurTypeState->mCurBaseTypeRef, baseTypeRef);
// We ignore errors here to avoid double-errors for type lookups, but this is where data cycles are detected
// but that type of error supersedes the mIgnoreErrors setting
@ -1850,6 +1850,7 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
if (typeDef->mIsCombinedPartial)
declTypeDef = typeDef->mPartials.front();
SetAndRestoreValue<BfTypeDef*> prevTypeDef(mContext->mCurTypeState->mCurTypeDef, declTypeDef);
SetAndRestoreValue<BfTypeDefineState> prevDefineState(typeInstance->mDefineState, BfTypeDefineState_ResolvingBaseType);
bool populateBase = !typeInstance->mTypeFailed;
auto checkType = ResolveTypeRef(checkTypeRef, populateBase ? BfPopulateType_Data : BfPopulateType_Declaration);