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

Fixed inner type lookup within generic base type

This commit is contained in:
Brian Fiete 2021-01-04 12:04:44 -08:00
parent 086b5f2e7d
commit ccacf0b9db

View file

@ -5979,6 +5979,7 @@ BfType* BfModule::ResolveInnerType(BfType* outerType, BfTypeReference* typeRef,
BF_ASSERT((namedTypeRef != NULL) || (directStrTypeRef != NULL)); BF_ASSERT((namedTypeRef != NULL) || (directStrTypeRef != NULL));
auto usedOuterType = outerType;
if (nestedTypeDef == NULL) if (nestedTypeDef == NULL)
{ {
StringView findName; StringView findName;
@ -6026,6 +6027,7 @@ BfType* BfModule::ResolveInnerType(BfType* outerType, BfTypeReference* typeRef,
Fail(StrFormat("'%s.%s' is inaccessible due to its protection level", TypeToString(checkOuterType).c_str(), BfTypeUtils::TypeToString(typeRef).c_str()), typeRef); // CS0122 Fail(StrFormat("'%s.%s' is inaccessible due to its protection level", TypeToString(checkOuterType).c_str(), BfTypeUtils::TypeToString(typeRef).c_str()), typeRef); // CS0122
} }
usedOuterType = checkOuterType;
nestedTypeDef = checkType; nestedTypeDef = checkType;
break; break;
} }
@ -6054,12 +6056,12 @@ BfType* BfModule::ResolveInnerType(BfType* outerType, BfTypeReference* typeRef,
} }
SetAndRestoreValue<bool> prevIgnoreErrors(mIgnoreErrors, ignoreErrors || mIgnoreErrors); SetAndRestoreValue<bool> prevIgnoreErrors(mIgnoreErrors, ignoreErrors || mIgnoreErrors);
if ((genericTypeRef != NULL) || (outerType->IsGenericTypeInstance())) if ((genericTypeRef != NULL) || (usedOuterType->IsGenericTypeInstance()))
{ {
BfTypeVector genericArgs; BfTypeVector genericArgs;
if (outerType->IsGenericTypeInstance()) if (usedOuterType->IsGenericTypeInstance())
{ {
auto genericTypeInst = (BfTypeInstance*)outerType; auto genericTypeInst = (BfTypeInstance*)usedOuterType;
genericArgs = genericTypeInst->mGenericTypeInfo->mTypeGenericArguments; genericArgs = genericTypeInst->mGenericTypeInfo->mTypeGenericArguments;
} }