1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed function type collision issue with params

This commit is contained in:
Brian Fiete 2025-01-29 18:22:59 -08:00
parent 185db196e0
commit 439ae8d3c4
3 changed files with 19 additions and 1 deletions

View file

@ -12731,6 +12731,9 @@ BfType* BfModule::ResolveTypeRef_Ref(BfTypeReference* typeRef, BfPopulateType po
if (paramType == NULL)
paramType = GetPrimitiveType(BfTypeCode_Var);
if ((param->mModToken != NULL) && (param->mModToken->mToken == BfToken_Params))
delegateInfo->mHasParams = true;
String paramName;
if (param->mNameNode != NULL)
paramName = param->mNameNode->ToString();

View file

@ -4407,6 +4407,12 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfType* rhs, LookupContext* ctx)
return false;
if (lhsDelegateInfo->mCallingConvention != rhsDelegateInfo->mCallingConvention)
return false;
if (lhsDelegateInfo->mHasParams != rhsDelegateInfo->mHasParams)
return false;
if (lhsDelegateInfo->mHasVarArgs != rhsDelegateInfo->mHasVarArgs)
return false;
if (lhsDelegateInfo->mHasExplicitThis != rhsDelegateInfo->mHasExplicitThis)
return false;
auto lhsMethodDef = lhsInst->mTypeDef->mMethods[0];
auto rhsMethodDef = rhsInst->mTypeDef->mMethods[0];
@ -4414,7 +4420,7 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfType* rhs, LookupContext* ctx)
if (lhsMethodDef->mCallingConvention != rhsMethodDef->mCallingConvention)
return false;
if (lhsMethodDef->mIsMutating != rhsMethodDef->mIsMutating)
return false;
return false;
if (lhsDelegateInfo->mReturnType != rhsDelegateInfo->mReturnType)
return false;
if (lhsDelegateInfo->mParams.size() != rhsDelegateInfo->mParams.size())
@ -4981,6 +4987,8 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
if (lhsParamsCount != (int)rhsDelegateType->mParams.size())
return false;
bool rhsHadParams = false;
for (int paramIdx = paramRefOfs; paramIdx < lhsDelegateInfo->mParams.size(); paramIdx++)
{
auto paramTypeRef = rhsDelegateType->mParams[paramIdx]->mTypeRef;
@ -4992,8 +5000,13 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
rhsParamName = rhsDelegateType->mParams[paramIdx]->mNameNode->ToStringView();
if (invokeMethodDef->mParams[paramIdx]->mName != rhsParamName)
return false;
if ((rhsDelegateType->mParams[paramIdx]->mModToken != NULL) && (rhsDelegateType->mParams[paramIdx]->mModToken->mToken == BfToken_Params))
rhsHadParams = true;
}
if (rhsHadParams != lhsDelegateInfo->mHasParams)
return false;
if ((ctx->mModule->mCurTypeInstance == NULL) || (!ctx->mModule->mCurTypeInstance->IsGenericTypeInstance()))
wantGeneric = false;

View file

@ -480,6 +480,7 @@ public:
Array<BfType*> mParams;
bool mHasExplicitThis;
bool mHasVarArgs;
bool mHasParams;
BfCallingConvention mCallingConvention;
public:
@ -488,6 +489,7 @@ public:
mReturnType = NULL;
mHasExplicitThis = false;
mHasVarArgs = false;
mHasParams = false;
mCallingConvention = BfCallingConvention_Unspecified;
}