@@ -1591,16 +1591,7 @@ void ConstraintSystem::openGenericParameters(DeclContext *outerDC,
1591
1591
1592
1592
// Create the type variables for the generic parameters.
1593
1593
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);
1604
1595
}
1605
1596
1606
1597
auto *baseLocator = getConstraintLocator (
@@ -1609,6 +1600,23 @@ void ConstraintSystem::openGenericParameters(DeclContext *outerDC,
1609
1600
bindArchetypesFromContext (*this , outerDC, baseLocator, replacements);
1610
1601
}
1611
1602
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
+
1612
1620
void ConstraintSystem::openGenericRequirements (
1613
1621
DeclContext *outerDC, GenericSignature signature,
1614
1622
bool skipProtocolSelfConstraint, ConstraintLocatorBuilder locator,
0 commit comments