@@ -663,26 +663,8 @@ static unsigned getNumRemovedArgumentLabels(ValueDecl *decl,
663663 llvm_unreachable (" Unhandled FunctionRefInfo in switch." );
664664}
665665
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) {
686668 switch (functionRefInfo.getApplyLevel ()) {
687669 case FunctionRefInfo::ApplyLevel::Unapplied:
688670 return 0 + hasAppliedSelf;
@@ -908,8 +890,8 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
908890
909891 auto origOpenedType = openedType;
910892 if (!isRequirementOrWitness (locator)) {
911- unsigned numApplies = getNumApplications (value, false , functionRefInfo ,
912- locator );
893+ unsigned numApplies = getNumApplications (/* hasAppliedSelf */ false ,
894+ functionRefInfo );
913895 openedType = adjustFunctionTypeForConcurrency (
914896 origOpenedType, /* baseType=*/ Type (), func, useDC, numApplies, false ,
915897 replacements, locator);
@@ -937,8 +919,8 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
937919
938920 auto origOpenedType = openedType;
939921 if (!isRequirementOrWitness (locator)) {
940- unsigned numApplies = getNumApplications (
941- funcDecl, false , functionRefInfo, locator );
922+ unsigned numApplies = getNumApplications (/* hasAppliedSelf */ false ,
923+ functionRefInfo );
942924 openedType = adjustFunctionTypeForConcurrency (
943925 origOpenedType->castTo <FunctionType>(), /* baseType=*/ Type (), funcDecl,
944926 useDC, numApplies, false , replacements, locator);
@@ -1680,8 +1662,7 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
16801662 if (isRequirementOrWitness (locator)) {
16811663 // Don't adjust when doing witness matching, because that can cause cycles.
16821664 } else if (isa<AbstractFunctionDecl>(value) || isa<EnumElementDecl>(value)) {
1683- unsigned numApplies = getNumApplications (
1684- value, hasAppliedSelf, functionRefInfo, locator);
1665+ unsigned numApplies = getNumApplications (hasAppliedSelf, functionRefInfo);
16851666 openedType = adjustFunctionTypeForConcurrency (
16861667 origOpenedType->castTo <FunctionType>(), resolvedBaseTy, value, useDC,
16871668 numApplies, isMainDispatchQueueMember (locator), replacements, locator);
@@ -1864,8 +1845,8 @@ Type ConstraintSystem::getEffectiveOverloadType(ConstraintLocator *locator,
18641845
18651846 auto hasAppliedSelf =
18661847 doesMemberRefApplyCurriedSelf (overload.getBaseType (), decl);
1867- unsigned numApplies = getNumApplications (
1868- decl, hasAppliedSelf, overload.getFunctionRefInfo (), locator );
1848+ unsigned numApplies = getNumApplications (hasAppliedSelf,
1849+ overload.getFunctionRefInfo ());
18691850
18701851 type = adjustFunctionTypeForConcurrency (
18711852 type->castTo <FunctionType>(), overload.getBaseType (), decl,
0 commit comments