diff --git a/lib/Sema/CSBindings.cpp b/lib/Sema/CSBindings.cpp index a05f865768a32..b159a8494c566 100644 --- a/lib/Sema/CSBindings.cpp +++ b/lib/Sema/CSBindings.cpp @@ -1072,7 +1072,7 @@ bool TypeVariableBinding::attempt(ConstraintSystem &cs) const { auto *dstLocator = TypeVar->getImpl().getLocator(); if (Binding.hasDefaultedLiteralProtocol()) { - type = cs.openUnboundGenericType(type, dstLocator); + type = cs.openUnboundGenericTypes(type, dstLocator); type = type->reconstituteSugar(/*recursive=*/false); } diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index 15b1d5ee7a85a..a384e5e54f6ed 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -1446,7 +1446,7 @@ namespace { if (auto *PD = dyn_cast(VD)) { if (!CS.hasType(PD)) { if (knownType && knownType->hasUnboundGenericType()) - knownType = CS.openUnboundGenericType(knownType, locator); + knownType = CS.openUnboundGenericTypes(knownType, locator); CS.setType( PD, knownType ? knownType @@ -1521,7 +1521,7 @@ namespace { if (!type || type->hasError()) return Type(); auto locator = CS.getConstraintLocator(E); - type = CS.openUnboundGenericType(type, locator); + type = CS.openUnboundGenericTypes(type, locator); return MetatypeType::get(type); } @@ -2205,7 +2205,7 @@ namespace { Type externalType; if (param->getTypeRepr()) { auto declaredTy = param->getType(); - externalType = CS.openUnboundGenericType(declaredTy, paramLoc); + externalType = CS.openUnboundGenericTypes(declaredTy, paramLoc); } else { // Let's allow parameters which haven't been explicitly typed // to become holes by default, this helps in situations like @@ -2439,7 +2439,7 @@ namespace { // Look through reference storage types. type = type->getReferenceStorageReferent(); - Type openedType = CS.openUnboundGenericType(type, locator); + Type openedType = CS.openUnboundGenericTypes(type, locator); assert(openedType); auto *subPattern = cast(pattern)->getSubPattern(); @@ -2541,7 +2541,7 @@ namespace { if (!castType) return Type(); - castType = CS.openUnboundGenericType( + castType = CS.openUnboundGenericTypes( castType, locator.withPathElement(LocatorPathElt::PatternMatch(pattern))); @@ -2607,7 +2607,7 @@ namespace { if (!parentType) return Type(); - parentType = CS.openUnboundGenericType( + parentType = CS.openUnboundGenericTypes( parentType, CS.getConstraintLocator( locator, {LocatorPathElt::PatternMatch(pattern), ConstraintLocator::ParentType})); @@ -3100,7 +3100,7 @@ namespace { // Open the type we're casting to. const auto toType = - CS.openUnboundGenericType(type, CS.getConstraintLocator(expr)); + CS.openUnboundGenericTypes(type, CS.getConstraintLocator(expr)); if (repr) CS.setType(repr, toType); auto fromType = CS.getType(fromExpr); @@ -3127,7 +3127,7 @@ namespace { // Open the type we're casting to. const auto toType = - CS.openUnboundGenericType(type, CS.getConstraintLocator(expr)); + CS.openUnboundGenericTypes(type, CS.getConstraintLocator(expr)); if (repr) CS.setType(repr, toType); auto fromType = CS.getType(expr->getSubExpr()); @@ -3160,7 +3160,7 @@ namespace { // Open the type we're casting to. const auto toType = - CS.openUnboundGenericType(type, CS.getConstraintLocator(expr)); + CS.openUnboundGenericTypes(type, CS.getConstraintLocator(expr)); if (repr) CS.setType(repr, toType); auto fromType = CS.getType(fromExpr); @@ -3189,7 +3189,7 @@ namespace { // Open up the type we're checking. // FIXME: Locator for the cast type? const auto toType = - CS.openUnboundGenericType(type, CS.getConstraintLocator(expr)); + CS.openUnboundGenericTypes(type, CS.getConstraintLocator(expr)); CS.setType(expr->getCastTypeRepr(), toType); // Add a checked cast constraint. @@ -3469,7 +3469,7 @@ namespace { rootRepr, TypeResolverContext::InExpression); if (!rootObjectTy || rootObjectTy->hasError()) return Type(); - rootObjectTy = CS.openUnboundGenericType(rootObjectTy, locator); + rootObjectTy = CS.openUnboundGenericTypes(rootObjectTy, locator); // Allow \Derived.property to be inferred as \Base.property to // simulate a sort of covariant conversion from // KeyPath to KeyPath. diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index 52eb827460772..7b28796ae60b1 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -661,7 +661,7 @@ ConstraintSystem::openUnboundGenericType(UnboundGenericType *unbound, auto unboundDecl = unbound->getDecl(); auto parentTy = unbound->getParent(); if (parentTy) { - parentTy = openUnboundGenericType(parentTy, locator); + parentTy = openUnboundGenericTypes(parentTy, locator); unbound = UnboundGenericType::get(unboundDecl, parentTy, getASTContext()); } @@ -782,7 +782,7 @@ static void checkNestedTypeConstraints(ConstraintSystem &cs, Type type, checkNestedTypeConstraints(cs, parentTy, locator); } -Type ConstraintSystem::openUnboundGenericType( +Type ConstraintSystem::openUnboundGenericTypes( Type type, ConstraintLocatorBuilder locator) { assert(!type->getCanonicalType()->hasTypeParameter()); @@ -1235,7 +1235,7 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value, checkNestedTypeConstraints(*this, type, locator); // Open the type. - type = openUnboundGenericType(type, locator); + type = openUnboundGenericTypes(type, locator); // Module types are not wrapped in metatypes. if (type->is()) @@ -1491,7 +1491,7 @@ ConstraintSystem::getTypeOfMemberReference( checkNestedTypeConstraints(*this, memberTy, locator); // Open the type if it was a reference to a generic type. - memberTy = openUnboundGenericType(memberTy, locator); + memberTy = openUnboundGenericTypes(memberTy, locator); // Wrap it in a metatype. memberTy = MetatypeType::get(memberTy); diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index d458367f0f40b..4c93b2ef74571 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -3420,7 +3420,7 @@ class ConstraintSystem { /// \param type The type to open. /// /// \returns The opened type. - Type openUnboundGenericType(Type type, ConstraintLocatorBuilder locator); + Type openUnboundGenericTypes(Type type, ConstraintLocatorBuilder locator); /// "Open" the given type by replacing any occurrences of generic /// parameter types and dependent member types with fresh type variables. diff --git a/lib/Sema/TypeCheckPropertyWrapper.cpp b/lib/Sema/TypeCheckPropertyWrapper.cpp index 5c1cdfc6f9987..6866e96a2100c 100644 --- a/lib/Sema/TypeCheckPropertyWrapper.cpp +++ b/lib/Sema/TypeCheckPropertyWrapper.cpp @@ -619,7 +619,7 @@ PropertyWrapperBackingPropertyTypeRequest::evaluate( // Open the type. Type openedWrapperType = - cs.openUnboundGenericType(rawWrapperType, emptyLocator); + cs.openUnboundGenericTypes(rawWrapperType, emptyLocator); if (!outermostOpenedWrapperType) outermostOpenedWrapperType = openedWrapperType;