mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Change in comparison operator selection priority
This commit is contained in:
parent
17d2db4cc4
commit
918a28bfb7
1 changed files with 12 additions and 12 deletions
|
@ -1071,6 +1071,17 @@ void BfMethodMatcher::CompareMethods(BfMethodInstance* prevMethodInstance, BfTyp
|
||||||
RETURN_RESULTS;
|
RETURN_RESULTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For operators, prefer explicit comparison over '<=>' comparison operator
|
||||||
|
if ((!isBetter) && (!isWorse))
|
||||||
|
{
|
||||||
|
if ((prevMethodDef->mIsOperator) && (newMethodDef->mIsOperator))
|
||||||
|
{
|
||||||
|
bool newIsComparison = ((BfOperatorDeclaration*)newMethodDef->mMethodDeclaration)->mBinOp == BfBinaryOp_Compare;
|
||||||
|
bool prevIsComparison = ((BfOperatorDeclaration*)prevMethodDef->mMethodDeclaration)->mBinOp == BfBinaryOp_Compare;
|
||||||
|
RETURN_BETTER_OR_WORSE(!newIsComparison, !prevIsComparison);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((newMethodInstance->mMethodDef->mExternalConstraints.size() != 0) || (prevMethodInstance->mMethodDef->mExternalConstraints.size() != 0))
|
if ((newMethodInstance->mMethodDef->mExternalConstraints.size() != 0) || (prevMethodInstance->mMethodDef->mExternalConstraints.size() != 0))
|
||||||
{
|
{
|
||||||
struct GenericParamPair
|
struct GenericParamPair
|
||||||
|
@ -1119,18 +1130,7 @@ void BfMethodMatcher::CompareMethods(BfMethodInstance* prevMethodInstance, BfTyp
|
||||||
// If both are empty partials then just bind to either
|
// If both are empty partials then just bind to either
|
||||||
isWorse = true;
|
isWorse = true;
|
||||||
RETURN_RESULTS;
|
RETURN_RESULTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For operators, prefer explicit comparison over '<=>' comparison operator
|
|
||||||
if ((!isBetter) && (!isWorse))
|
|
||||||
{
|
|
||||||
if ((prevMethodDef->mIsOperator) && (newMethodDef->mIsOperator))
|
|
||||||
{
|
|
||||||
bool newIsComparison = ((BfOperatorDeclaration*)newMethodDef->mMethodDeclaration)->mBinOp == BfBinaryOp_Compare;
|
|
||||||
bool prevIsComparison = ((BfOperatorDeclaration*)prevMethodDef->mMethodDeclaration)->mBinOp == BfBinaryOp_Compare;
|
|
||||||
RETURN_BETTER_OR_WORSE(!newIsComparison, !prevIsComparison);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// For extensions, select the version in the most-specific project (only applicable for ctors)
|
// For extensions, select the version in the most-specific project (only applicable for ctors)
|
||||||
if ((!isBetter) && (!isWorse))
|
if ((!isBetter) && (!isWorse))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue