mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Fix for unbound generic type lookups
This commit is contained in:
parent
c2490278fa
commit
e5f280de32
4 changed files with 20 additions and 6 deletions
|
@ -3146,11 +3146,13 @@ void BfResolvedTypeSet::HashGenericArguments(BfTypeReference* typeRef, LookupCon
|
|||
{
|
||||
for (int genericIdx = 0; genericIdx < BF_MAX(genericTypeRef->mGenericArguments.mSize, genericTypeRef->mCommas.mSize + 1); genericIdx++)
|
||||
{
|
||||
bool allowUnboundGeneric = ((ctx->mResolveFlags & BfResolveTypeRefFlag_AllowUnboundGeneric) != 0) && (typeRef == ctx->mRootTypeRef);
|
||||
|
||||
BfAstNode* genericArgTypeRef = NULL;
|
||||
if (genericIdx < genericTypeRef->mGenericArguments.mSize)
|
||||
genericArgTypeRef = genericTypeRef->mGenericArguments[genericIdx];
|
||||
|
||||
if ((ctx->mResolveFlags & BfResolveTypeRefFlag_AllowUnboundGeneric) != 0)
|
||||
if (allowUnboundGeneric)
|
||||
{
|
||||
if (BfNodeIsExact<BfWildcardTypeReference>(genericArgTypeRef))
|
||||
genericArgTypeRef = NULL;
|
||||
|
@ -3160,14 +3162,15 @@ void BfResolvedTypeSet::HashGenericArguments(BfTypeReference* typeRef, LookupCon
|
|||
if (genericArgTypeRef != NULL)
|
||||
{
|
||||
argHashVal = Hash(genericArgTypeRef, ctx, BfHashFlag_AllowGenericParamConstValue, hashSeed + 1);
|
||||
if ((ctx->mResolveFlags & BfResolveTypeRefFlag_ForceUnboundGeneric) != 0)
|
||||
if ((allowUnboundGeneric) && ((ctx->mResolveFlags & BfResolveTypeRefFlag_ForceUnboundGeneric) != 0))
|
||||
genericArgTypeRef = NULL;
|
||||
}
|
||||
|
||||
if (genericArgTypeRef == NULL)
|
||||
{
|
||||
if ((ctx->mResolveFlags & BfResolveTypeRefFlag_AllowUnboundGeneric) != 0)
|
||||
{
|
||||
if (allowUnboundGeneric)
|
||||
{
|
||||
ctx->mIsUnboundGeneric = true;
|
||||
argHashVal = (((int)BfGenericParamKind_Type + 0xB00) << 8) ^ (genericIdx + 1);
|
||||
argHashVal = HASH_MIX(argHashVal, hashSeed + 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue