1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed attempt to declare base type for an interface

This commit is contained in:
Brian Fiete 2022-03-23 17:07:31 -07:00
parent 72126ba80c
commit 17b29c7227

View file

@ -3827,6 +3827,12 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
} }
} }
if ((typeInstance->IsInterface()) && (baseTypeInst != NULL))
{
Fail("Interfaces cannot declare base types", baseTypeRef, true);
baseTypeInst = NULL;
}
if ((baseTypeInst != NULL) && (typeInstance->mBaseType == NULL)) if ((baseTypeInst != NULL) && (typeInstance->mBaseType == NULL))
{ {
if (typeInstance->mTypeFailed) if (typeInstance->mTypeFailed)
@ -3848,14 +3854,12 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
if ((resolvedTypeRef->IsObject()) && (!baseTypeInst->IsObject())) if ((resolvedTypeRef->IsObject()) && (!baseTypeInst->IsObject()))
{ {
Fail("Class can only derive from another class", baseTypeRef, true); Fail("Class can only derive from another class", baseTypeRef, true);
//typeInstance->mTypeFailed = true;
baseTypeInst = defaultBaseTypeInst; baseTypeInst = defaultBaseTypeInst;
typeInstance->mBaseType = baseTypeInst; typeInstance->mBaseType = baseTypeInst;
} }
else if ((resolvedTypeRef->IsStruct()) && (!baseTypeInst->IsValueType())) else if ((resolvedTypeRef->IsStruct()) && (!baseTypeInst->IsValueType()))
{ {
Fail("Struct can only derive from another struct", baseTypeRef, true); Fail("Struct can only derive from another struct", baseTypeRef, true);
//typeInstance->mTypeFailed = true;
baseTypeInst = defaultBaseTypeInst; baseTypeInst = defaultBaseTypeInst;
typeInstance->mBaseType = baseTypeInst; typeInstance->mBaseType = baseTypeInst;
} }