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

Fixed an issue with primitive type aliases as generic params

This commit is contained in:
Brian Fiete 2020-02-17 10:26:41 -08:00
parent a4d9d5a52f
commit fe531be4ef
2 changed files with 7 additions and 9 deletions

View file

@ -7130,6 +7130,11 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
} }
} }
if (typeRef->ToString() == "Issue.I?")
{
NOP;
}
BfResolvedTypeSet::LookupContext lookupCtx; BfResolvedTypeSet::LookupContext lookupCtx;
lookupCtx.mRootTypeRef = typeRef; lookupCtx.mRootTypeRef = typeRef;
lookupCtx.mRootTypeDef = typeDef; lookupCtx.mRootTypeDef = typeDef;

View file

@ -3065,6 +3065,8 @@ BfTypeDef* BfResolvedTypeSet::LookupContext::ResolveToTypeDef(BfTypeReference* t
auto type = mModule->ResolveTypeRef(typeReference, BfPopulateType_Identity, BfResolveTypeRefFlag_AllowGenericParamConstValue); auto type = mModule->ResolveTypeRef(typeReference, BfPopulateType_Identity, BfResolveTypeRefFlag_AllowGenericParamConstValue);
if (type == NULL) if (type == NULL)
return NULL; return NULL;
if (type->IsPrimitiveType())
return ((BfPrimitiveType*)type)->mTypeDef;
auto typeInst = type->ToTypeInstance(); auto typeInst = type->ToTypeInstance();
if (typeInst == NULL) if (typeInst == NULL)
return NULL; return NULL;
@ -3259,18 +3261,9 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
return true; return true;
} }
if (!rhs->IsTypeDefTypeReference())
return false;
BfPrimitiveType* lhsPrimType = (BfPrimitiveType*)lhs; BfPrimitiveType* lhsPrimType = (BfPrimitiveType*)lhs;
auto rhsTypeDef = ctx->ResolveToTypeDef(rhs); auto rhsTypeDef = ctx->ResolveToTypeDef(rhs);
return lhsPrimType->mTypeDef == rhsTypeDef; return lhsPrimType->mTypeDef == rhsTypeDef;
// auto rhsTypeDefTypeRef = BfNodeDynCast<BfTypeDefTypeReference>(rhs);
// if (rhsTypeDefTypeRef == NULL)
// return false;
// BfPrimitiveType* lhsPrimType = (BfPrimitiveType*)lhs;
// return lhsPrimType->mTypeDef == rhsTypeDefTypeRef->mTypeDef;
} }
else if (lhs->IsPointer()) else if (lhs->IsPointer())
{ {