@@ -1858,7 +1858,7 @@ static FunctionType *applyOptionality(ValueDecl *value, FunctionType *fnTy) {
18581858std::pair<Type, Type>
18591859ConstraintSystem::getTypeOfMemberReferenceImpl (
18601860 OverloadChoice choice, DeclContext *useDC,
1861- ConstraintLocator *locator, SmallVectorImpl<OpenedType> *replacementsPtr,
1861+ ConstraintLocator *locator,
18621862 PreparedOverloadBuilder *preparedOverload) {
18631863 ASSERT (!!preparedOverload == PreparingOverload);
18641864
@@ -1888,28 +1888,23 @@ ConstraintSystem::getTypeOfMemberReferenceImpl(
18881888 auto genericSig = innerDC->getGenericSignatureOfContext ();
18891889
18901890 // Open the type of the generic function or member of a generic type.
1891- ArrayRef<OpenedType> replacements;
1892- SmallVector<OpenedType, 4 > localReplacements;
1893- {
1894- auto &_replacements = replacementsPtr ? *replacementsPtr : localReplacements;
1895-
1896- // If we have a generic signature, open the parameters. We delay opening
1897- // requirements to allow contextual types to affect the situation.
1898- if (genericSig) {
1899- openGenericParameters (outerDC, genericSig, _replacements, locator,
1900- preparedOverload);
1901- }
1891+ SmallVector<OpenedType, 4 > replacements;
19021892
1903- // If we opened up any type variables, record the replacements. We do this
1904- // up-front to allow requirement fix coalescing logic to work correctly with
1905- // requirements imposed on base type (since that relies on being able to
1906- // find the recorded opened type). We then make the array immutable for the
1907- // following logic to ensure they don't attempt to add any additional opened
1908- // types.
1909- recordOpenedTypes (locator, _replacements, preparedOverload);
1910- replacements = _replacements;
1893+ // If we have a generic signature, open the parameters. We delay opening
1894+ // requirements to allow contextual types to affect the situation.
1895+ if (genericSig) {
1896+ openGenericParameters (outerDC, genericSig, replacements, locator,
1897+ preparedOverload);
19111898 }
19121899
1900+ // If we opened up any type variables, record the replacements. We do this
1901+ // up-front to allow requirement fix coalescing logic to work correctly with
1902+ // requirements imposed on base type (since that relies on being able to
1903+ // find the recorded opened type). We then make the array immutable for the
1904+ // following logic to ensure they don't attempt to add any additional opened
1905+ // types.
1906+ recordOpenedTypes (locator, replacements, preparedOverload);
1907+
19131908 // Check to see if the self parameter is applied, in which case we'll want to
19141909 // strip it off later.
19151910 auto hasAppliedSelf = doesMemberRefApplyCurriedSelf (baseRValueTy, value);
@@ -2039,7 +2034,6 @@ ConstraintSystem::getTypeOfMemberReferenceImpl(
20392034
20402035DeclReferenceType ConstraintSystem::getTypeOfMemberReference (
20412036 OverloadChoice choice, DeclContext *useDC, ConstraintLocator *locator,
2042- SmallVectorImpl<OpenedType> *replacementsPtr,
20432037 PreparedOverloadBuilder *preparedOverload) {
20442038 ASSERT (!!preparedOverload == PreparingOverload);
20452039
@@ -2056,8 +2050,7 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
20562050
20572051 Type openedType, thrownErrorType;
20582052 std::tie (openedType, thrownErrorType)
2059- = getTypeOfMemberReferenceImpl (choice, useDC, locator, replacementsPtr,
2060- preparedOverload);
2053+ = getTypeOfMemberReferenceImpl (choice, useDC, locator, preparedOverload);
20612054
20622055 if (isa<TypeDecl>(value)) {
20632056 auto type = openedType->castTo <FunctionType>()->getResult ();
@@ -2852,11 +2845,9 @@ ConstraintSystem::prepareOverloadImpl(ConstraintLocator *locator,
28522845 return getTypeOfReference (choice, locator, useDC, preparedOverload);
28532846 }
28542847
2855- return getTypeOfMemberReference (
2856- choice, useDC, locator, /* replacements=*/ nullptr , preparedOverload);
2848+ return getTypeOfMemberReference (choice, useDC, locator, preparedOverload);
28572849 } else {
2858- return getTypeOfReference (
2859- choice, locator, useDC, preparedOverload);
2850+ return getTypeOfReference (choice, locator, useDC, preparedOverload);
28602851 }
28612852}
28622853
0 commit comments