1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +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) if (paramType == NULL)
paramType = GetPrimitiveType(BfTypeCode_Var); paramType = GetPrimitiveType(BfTypeCode_Var);
if ((param->mModToken != NULL) && (param->mModToken->mToken == BfToken_Params))
delegateInfo->mHasParams = true;
String paramName; String paramName;
if (param->mNameNode != NULL) if (param->mNameNode != NULL)
paramName = param->mNameNode->ToString(); paramName = param->mNameNode->ToString();

View file

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

View file

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