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

Experimental disabling of 'wantGeneric=false' for inner delegates/tuples

This commit is contained in:
Brian Fiete 2022-01-01 06:36:48 -05:00
parent 156585773d
commit ef6b52a0ac
4 changed files with 54 additions and 9 deletions

View file

@ -4088,6 +4088,8 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
if (rhsDelegateType == NULL)
return false;
bool wantGeneric = false;
BfDelegateInfo* lhsDelegateInfo = lhs->GetDelegateInfo();
auto lhsTypeInstance = lhs->ToTypeInstance();
@ -4098,6 +4100,12 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
if ((lhs->IsDelegate()) != rhsIsDelegate)
return false;
auto _CheckType = [&](BfType* type)
{
if (type->IsTypeGenericParam())
wantGeneric = true;
};
BfCallingConvention rhsCallingConvention = BfCallingConvention_Unspecified;
if (ctx->mRootTypeRef == rhsDelegateType)
@ -4105,9 +4113,10 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
else
ctx->mModule->GetDelegateTypeRefAttributes(rhsDelegateType, rhsCallingConvention);
if (lhsDelegateInfo->mCallingConvention != rhsCallingConvention)
return false;
return false;
if (!Equals(lhsDelegateInfo->mReturnType, rhsDelegateType->mReturnType, ctx))
return false;
_CheckType(lhsDelegateInfo->mReturnType);
bool isMutating = true;
@ -4155,12 +4164,23 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
auto paramTypeRef = rhsDelegateType->mParams[paramIdx]->mTypeRef;
if (!Equals(lhsDelegateInfo->mParams[paramIdx], paramTypeRef, ctx))
return false;
_CheckType(lhsDelegateInfo->mParams[paramIdx]);
StringView rhsParamName;
if (rhsDelegateType->mParams[paramIdx]->mNameNode != NULL)
rhsParamName = rhsDelegateType->mParams[paramIdx]->mNameNode->ToStringView();
if (invokeMethodDef->mParams[paramIdx]->mName != rhsParamName)
return false;
}
if ((ctx->mModule->mCurTypeInstance == NULL) || (!ctx->mModule->mCurTypeInstance->IsGenericTypeInstance()))
wantGeneric = false;
//TODO:
wantGeneric = false;
if (wantGeneric != lhsTypeInstance->IsGenericTypeInstance())
return false;
return true;
}
else if (lhs->IsTypeInstance())