mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-16 15:24:10 +02:00
More sophisticated Self equality check (ie: 'Result<Self>')
This commit is contained in:
parent
c6ca4c8bb4
commit
913d60ef5b
1 changed files with 11 additions and 5 deletions
|
@ -4940,12 +4940,18 @@ String BfTypeUtils::TypeToString(BfAstNode* typeRefNode)
|
||||||
return typeRef->ToString();
|
return typeRef->ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BfTypeUtils::TypeEquals(BfType* typeA, BfType* typeB, BfType* selfType)
|
bool BfTypeUtils::TypeEquals(BfType* typeA, BfType* typeB, BfTypeInstance* selfType)
|
||||||
{
|
{
|
||||||
if (typeA->IsSelf())
|
if (typeA->IsUnspecializedTypeVariation())
|
||||||
typeA = selfType;
|
{
|
||||||
if (typeB->IsSelf())
|
SetAndRestoreValue<BfTypeInstance*> prevCurTypeInst(selfType->mModule->mCurTypeInstance, selfType);
|
||||||
typeB = selfType;
|
return selfType->mModule->ResolveGenericType(typeA, NULL, NULL);
|
||||||
|
}
|
||||||
|
if (typeB->IsUnspecializedTypeVariation())
|
||||||
|
{
|
||||||
|
SetAndRestoreValue<BfTypeInstance*> prevCurTypeInst(selfType->mModule->mCurTypeInstance, selfType);
|
||||||
|
return selfType->mModule->ResolveGenericType(typeB, NULL, NULL);
|
||||||
|
}
|
||||||
return typeA == typeB;
|
return typeA == typeB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue