@@ -663,26 +663,8 @@ static unsigned getNumRemovedArgumentLabels(ValueDecl *decl,
663
663
llvm_unreachable (" Unhandled FunctionRefInfo in switch." );
664
664
}
665
665
666
- // / Determine the number of applications
667
- unsigned constraints::getNumApplications (ValueDecl *decl, bool hasAppliedSelf,
668
- FunctionRefInfo functionRefInfo,
669
- ConstraintLocatorBuilder locator) {
670
- // FIXME: Narrow hack for rdar://139234188 - Currently we set
671
- // FunctionRefInfo::Compound for enum element patterns with tuple
672
- // sub-patterns to ensure the member has argument labels stripped. As such,
673
- // we need to account for the correct application level here. We ought to be
674
- // setting the correct FunctionRefInfo and properly handling the label
675
- // matching in the solver though.
676
- if (auto lastElt = locator.last ()) {
677
- if (auto matchElt = lastElt->getAs <LocatorPathElt::PatternMatch>()) {
678
- if (auto *EP = dyn_cast<EnumElementPattern>(matchElt->getPattern ()))
679
- return (EP->hasSubPattern () ? 1 : 0 ) + hasAppliedSelf;
680
- }
681
- }
682
- // FIXME(FunctionRefInfo): This matches the old behavior, but is wrong.
683
- if (functionRefInfo.isCompoundName ())
684
- return 0 + hasAppliedSelf;
685
-
666
+ unsigned constraints::getNumApplications (bool hasAppliedSelf,
667
+ FunctionRefInfo functionRefInfo) {
686
668
switch (functionRefInfo.getApplyLevel ()) {
687
669
case FunctionRefInfo::ApplyLevel::Unapplied:
688
670
return 0 + hasAppliedSelf;
@@ -908,8 +890,8 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
908
890
909
891
auto origOpenedType = openedType;
910
892
if (!isRequirementOrWitness (locator)) {
911
- unsigned numApplies = getNumApplications (value, false , functionRefInfo ,
912
- locator );
893
+ unsigned numApplies = getNumApplications (/* hasAppliedSelf */ false ,
894
+ functionRefInfo );
913
895
openedType = adjustFunctionTypeForConcurrency (
914
896
origOpenedType, /* baseType=*/ Type (), func, useDC, numApplies, false ,
915
897
replacements, locator);
@@ -937,8 +919,8 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
937
919
938
920
auto origOpenedType = openedType;
939
921
if (!isRequirementOrWitness (locator)) {
940
- unsigned numApplies = getNumApplications (
941
- funcDecl, false , functionRefInfo, locator );
922
+ unsigned numApplies = getNumApplications (/* hasAppliedSelf */ false ,
923
+ functionRefInfo );
942
924
openedType = adjustFunctionTypeForConcurrency (
943
925
origOpenedType->castTo <FunctionType>(), /* baseType=*/ Type (), funcDecl,
944
926
useDC, numApplies, false , replacements, locator);
@@ -1680,8 +1662,7 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
1680
1662
if (isRequirementOrWitness (locator)) {
1681
1663
// Don't adjust when doing witness matching, because that can cause cycles.
1682
1664
} else if (isa<AbstractFunctionDecl>(value) || isa<EnumElementDecl>(value)) {
1683
- unsigned numApplies = getNumApplications (
1684
- value, hasAppliedSelf, functionRefInfo, locator);
1665
+ unsigned numApplies = getNumApplications (hasAppliedSelf, functionRefInfo);
1685
1666
openedType = adjustFunctionTypeForConcurrency (
1686
1667
origOpenedType->castTo <FunctionType>(), resolvedBaseTy, value, useDC,
1687
1668
numApplies, isMainDispatchQueueMember (locator), replacements, locator);
@@ -1864,8 +1845,8 @@ Type ConstraintSystem::getEffectiveOverloadType(ConstraintLocator *locator,
1864
1845
1865
1846
auto hasAppliedSelf =
1866
1847
doesMemberRefApplyCurriedSelf (overload.getBaseType (), decl);
1867
- unsigned numApplies = getNumApplications (
1868
- decl, hasAppliedSelf, overload.getFunctionRefInfo (), locator );
1848
+ unsigned numApplies = getNumApplications (hasAppliedSelf,
1849
+ overload.getFunctionRefInfo ());
1869
1850
1870
1851
type = adjustFunctionTypeForConcurrency (
1871
1852
type->castTo <FunctionType>(), overload.getBaseType (), decl,
0 commit comments