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

Derived CRTP fixes

This commit is contained in:
Brian Fiete 2021-02-12 09:31:09 -08:00
parent fda6c326c0
commit a6e8436b2f
3 changed files with 45 additions and 1 deletions

View file

@ -3022,7 +3022,10 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
bool populateBase = !typeInstance->mTypeFailed;
auto checkType = ResolveTypeRef(checkTypeRef, BfPopulateType_Declaration);
if ((checkType != NULL) && (!checkType->IsInterface()) && (populateBase))
{
SetAndRestoreValue<BfTypeInstance*> prevBaseType(mContext->mCurTypeState->mCurBaseType, checkType->ToTypeInstance());
PopulateType(checkType, BfPopulateType_Data);
}
if (typeInstance->mDefineState >= BfTypeDefineState_Defined)
{
@ -12793,6 +12796,19 @@ bool BfModule::TypeIsSubTypeOf(BfTypeInstance* srcType, BfTypeInstance* wantType
if (srcType->mDefineState < BfTypeDefineState_HasInterfaces)
{
if (srcType->mDefineState == BfTypeDefineState_ResolvingBaseType)
{
auto typeState = mContext->mCurTypeState;
while (typeState != NULL)
{
if ((typeState->mTypeInstance == srcType) && (typeState->mCurBaseType != NULL))
{
return TypeIsSubTypeOf(typeState->mCurBaseType, wantType, checkAccessibility);
}
typeState = typeState->mPrevState;
}
}
// Type is incomplete. We don't do the IsIncomplete check here because of re-entry
// While handling 'var' resolution, we don't want to force a PopulateType reentry
// but we do have enough information for TypeIsSubTypeOf