@@ -1591,16 +1591,7 @@ void ConstraintSystem::openGenericParameters(DeclContext *outerDC,
15911591
15921592 // Create the type variables for the generic parameters.
15931593 for (auto gp : sig.getGenericParams ()) {
1594- auto *paramLocator = getConstraintLocator (
1595- locator.withPathElement (LocatorPathElt::GenericParameter (gp)));
1596-
1597- auto typeVar = createTypeVariable (paramLocator, TVO_PrefersSubtypeBinding |
1598- TVO_CanBindToHole);
1599- auto result = replacements.insert (std::make_pair (
1600- cast<GenericTypeParamType>(gp->getCanonicalType ()), typeVar));
1601-
1602- assert (result.second );
1603- (void )result;
1594+ (void )openGenericParameter (outerDC, gp, replacements, locator);
16041595 }
16051596
16061597 auto *baseLocator = getConstraintLocator (
@@ -1609,6 +1600,23 @@ void ConstraintSystem::openGenericParameters(DeclContext *outerDC,
16091600 bindArchetypesFromContext (*this , outerDC, baseLocator, replacements);
16101601}
16111602
1603+ TypeVariableType *ConstraintSystem::openGenericParameter (
1604+ DeclContext *outerDC, GenericTypeParamType *parameter,
1605+ OpenedTypeMap &replacements, ConstraintLocatorBuilder locator) {
1606+ auto *paramLocator = getConstraintLocator (
1607+ locator.withPathElement (LocatorPathElt::GenericParameter (parameter)));
1608+
1609+ auto typeVar = createTypeVariable (paramLocator, TVO_PrefersSubtypeBinding |
1610+ TVO_CanBindToHole);
1611+ auto result = replacements.insert (std::make_pair (
1612+ cast<GenericTypeParamType>(parameter->getCanonicalType ()), typeVar));
1613+
1614+ assert (result.second );
1615+ (void )result;
1616+
1617+ return typeVar;
1618+ }
1619+
16121620void ConstraintSystem::openGenericRequirements (
16131621 DeclContext *outerDC, GenericSignature signature,
16141622 bool skipProtocolSelfConstraint, ConstraintLocatorBuilder locator,
0 commit comments