1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Added stricter method extension 'this' pre-check

This commit is contained in:
Brian Fiete 2021-01-22 14:19:02 -08:00
parent 5aeaa8808b
commit 0b23446aa8

View file

@ -2219,6 +2219,16 @@ NoMatch:
if (mBestMethodDef != NULL)
return false;
if (checkMethod->mMethodType == BfMethodType_Extension)
{
auto thisParam = methodInstance->GetParamType(0);
auto resolveThisParam = mModule->ResolveGenericType(thisParam, NULL, &mCheckMethodGenericArguments);
if (resolveThisParam == NULL)
return false;
if (!mModule->CanCast(mTarget, resolveThisParam))
return false;
}
if (mBackupMethodDef != NULL)
{
int prevParamDiff = (int)mBackupMethodDef->GetExplicitParamCount() - (int)mArguments.size();