mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-28 20:46:00 +02:00
Improved method selection for extension methods with generic 'this'
This commit is contained in:
parent
cc107ae341
commit
e64e421feb
2 changed files with 30 additions and 3 deletions
|
@ -889,7 +889,7 @@ void BfMethodMatcher::CompareMethods(BfMethodInstance* prevMethodInstance, BfTyp
|
|||
|
||||
bool paramWasConstExpr = false;
|
||||
bool prevParamWasConstExpr = false;
|
||||
|
||||
|
||||
bool paramWasUnspecialized = paramType->IsUnspecializedType();
|
||||
if ((genericArgumentsSubstitute != NULL) && (paramWasUnspecialized))
|
||||
{
|
||||
|
@ -952,9 +952,16 @@ void BfMethodMatcher::CompareMethods(BfMethodInstance* prevMethodInstance, BfTyp
|
|||
else if ((wasArgDeferred) && (paramType != prevParamType) && (paramType == arg.mType) && (paramType == resolvedArg->mBestBoundType))
|
||||
isBetter = true;
|
||||
else if ((wasArgDeferred) && (paramType != prevParamType) && (prevParamType == arg.mType) && (prevParamType == resolvedArg->mBestBoundType))
|
||||
isWorse = true;
|
||||
isWorse = true;
|
||||
else if ((argIdx == -1) && (anyIsExtension))
|
||||
{
|
||||
if ((newMethodInstance->mMethodDef->mMethodType == BfMethodType_Extension) && (wasGenericParam) && (!prevWasGenericParam))
|
||||
isWorse = true;
|
||||
else if ((prevMethodInstance->mMethodDef->mMethodType == BfMethodType_Extension) && (prevWasGenericParam) && (!wasGenericParam))
|
||||
isBetter = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
bool canCastFromCurToPrev = mModule->CanCast(mModule->GetFakeTypedValue(paramType), prevParamType, implicitCastFlags);
|
||||
bool canCastFromPrevToCur = mModule->CanCast(mModule->GetFakeTypedValue(prevParamType), paramType, implicitCastFlags);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue