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

Fixed lookup for inner type declared in a generic base class

This commit is contained in:
Brian Fiete 2024-09-09 11:18:36 -04:00
parent b7e47027c3
commit d9fd93ccbd
2 changed files with 26 additions and 1 deletions

View file

@ -3417,7 +3417,21 @@ BfTypeDef* BfResolvedTypeSet::FindRootCommonOuterType(BfTypeDef* outerType, Look
{
if (ctx->mModule->mCurTypeInstance == NULL)
return NULL;
BfTypeDef* commonOuterType = ctx->mModule->FindCommonOuterType(ctx->mModule->mCurTypeInstance->mTypeDef, outerType);
BfTypeDef* commonOuterType = NULL;
auto checkOuterTypeInst = ctx->mModule->mCurTypeInstance;
while (checkOuterTypeInst != NULL)
{
commonOuterType = ctx->mModule->FindCommonOuterType(checkOuterTypeInst->mTypeDef, outerType);
if (commonOuterType != NULL)
{
outOuterTypeInstance = checkOuterTypeInst;
break;
}
checkOuterTypeInst = checkOuterTypeInst->mBaseType;
}
if ((commonOuterType == NULL) && (outerType != NULL))
{
auto staticSearch = ctx->mModule->GetStaticSearch();
@ -3462,7 +3476,11 @@ int BfResolvedTypeSet::DoHash(BfTypeReference* typeRef, LookupContext* ctx, BfHa
auto outerType = ctx->mModule->mSystem->GetOuterTypeNonPartial(typeDef);
if (typeRef == ctx->mRootTypeRef)
{
commonOuterType = FindRootCommonOuterType(outerType, ctx, checkTypeInstance);
if ((checkTypeInstance != NULL) && (checkTypeInstance->IsBoxed()))
checkTypeInstance = checkTypeInstance->GetUnderlyingType()->ToTypeInstance();
}
else
commonOuterType = ctx->mModule->FindCommonOuterType(ctx->mModule->mCurTypeInstance->mTypeDef, outerType);

View file

@ -1,5 +1,7 @@
#pragma warning disable 168
using System.Collections;
namespace Tests
{
class ClassE
@ -120,4 +122,9 @@ namespace Tests
}
}
}
class DictExt : Dictionary<int, float>
{
Entry mEntry;
}
}