Skip to content

Commit 399e533

Browse files
Merge pull request #32326 from AnthonyLatsis/openunbound-disambig
[NFC] CS: Give the type-transforming openUnboundGenericType method a more accurate name
2 parents b5a8b51 + 86b7e98 commit 399e533

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ bool TypeVariableBinding::attempt(ConstraintSystem &cs) const {
10721072
auto *dstLocator = TypeVar->getImpl().getLocator();
10731073

10741074
if (Binding.hasDefaultedLiteralProtocol()) {
1075-
type = cs.openUnboundGenericType(type, dstLocator);
1075+
type = cs.openUnboundGenericTypes(type, dstLocator);
10761076
type = type->reconstituteSugar(/*recursive=*/false);
10771077
}
10781078

lib/Sema/CSGen.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ namespace {
14461446
if (auto *PD = dyn_cast<ParamDecl>(VD)) {
14471447
if (!CS.hasType(PD)) {
14481448
if (knownType && knownType->hasUnboundGenericType())
1449-
knownType = CS.openUnboundGenericType(knownType, locator);
1449+
knownType = CS.openUnboundGenericTypes(knownType, locator);
14501450

14511451
CS.setType(
14521452
PD, knownType ? knownType
@@ -1521,7 +1521,7 @@ namespace {
15211521
if (!type || type->hasError()) return Type();
15221522

15231523
auto locator = CS.getConstraintLocator(E);
1524-
type = CS.openUnboundGenericType(type, locator);
1524+
type = CS.openUnboundGenericTypes(type, locator);
15251525
return MetatypeType::get(type);
15261526
}
15271527

@@ -2205,7 +2205,7 @@ namespace {
22052205
Type externalType;
22062206
if (param->getTypeRepr()) {
22072207
auto declaredTy = param->getType();
2208-
externalType = CS.openUnboundGenericType(declaredTy, paramLoc);
2208+
externalType = CS.openUnboundGenericTypes(declaredTy, paramLoc);
22092209
} else {
22102210
// Let's allow parameters which haven't been explicitly typed
22112211
// to become holes by default, this helps in situations like
@@ -2439,7 +2439,7 @@ namespace {
24392439
// Look through reference storage types.
24402440
type = type->getReferenceStorageReferent();
24412441

2442-
Type openedType = CS.openUnboundGenericType(type, locator);
2442+
Type openedType = CS.openUnboundGenericTypes(type, locator);
24432443
assert(openedType);
24442444

24452445
auto *subPattern = cast<TypedPattern>(pattern)->getSubPattern();
@@ -2541,7 +2541,7 @@ namespace {
25412541
if (!castType)
25422542
return Type();
25432543

2544-
castType = CS.openUnboundGenericType(
2544+
castType = CS.openUnboundGenericTypes(
25452545
castType,
25462546
locator.withPathElement(LocatorPathElt::PatternMatch(pattern)));
25472547

@@ -2607,7 +2607,7 @@ namespace {
26072607
if (!parentType)
26082608
return Type();
26092609

2610-
parentType = CS.openUnboundGenericType(
2610+
parentType = CS.openUnboundGenericTypes(
26112611
parentType, CS.getConstraintLocator(
26122612
locator, {LocatorPathElt::PatternMatch(pattern),
26132613
ConstraintLocator::ParentType}));
@@ -3100,7 +3100,7 @@ namespace {
31003100

31013101
// Open the type we're casting to.
31023102
const auto toType =
3103-
CS.openUnboundGenericType(type, CS.getConstraintLocator(expr));
3103+
CS.openUnboundGenericTypes(type, CS.getConstraintLocator(expr));
31043104
if (repr) CS.setType(repr, toType);
31053105

31063106
auto fromType = CS.getType(fromExpr);
@@ -3127,7 +3127,7 @@ namespace {
31273127

31283128
// Open the type we're casting to.
31293129
const auto toType =
3130-
CS.openUnboundGenericType(type, CS.getConstraintLocator(expr));
3130+
CS.openUnboundGenericTypes(type, CS.getConstraintLocator(expr));
31313131
if (repr) CS.setType(repr, toType);
31323132

31333133
auto fromType = CS.getType(expr->getSubExpr());
@@ -3160,7 +3160,7 @@ namespace {
31603160

31613161
// Open the type we're casting to.
31623162
const auto toType =
3163-
CS.openUnboundGenericType(type, CS.getConstraintLocator(expr));
3163+
CS.openUnboundGenericTypes(type, CS.getConstraintLocator(expr));
31643164
if (repr) CS.setType(repr, toType);
31653165

31663166
auto fromType = CS.getType(fromExpr);
@@ -3189,7 +3189,7 @@ namespace {
31893189
// Open up the type we're checking.
31903190
// FIXME: Locator for the cast type?
31913191
const auto toType =
3192-
CS.openUnboundGenericType(type, CS.getConstraintLocator(expr));
3192+
CS.openUnboundGenericTypes(type, CS.getConstraintLocator(expr));
31933193
CS.setType(expr->getCastTypeRepr(), toType);
31943194

31953195
// Add a checked cast constraint.
@@ -3469,7 +3469,7 @@ namespace {
34693469
rootRepr, TypeResolverContext::InExpression);
34703470
if (!rootObjectTy || rootObjectTy->hasError())
34713471
return Type();
3472-
rootObjectTy = CS.openUnboundGenericType(rootObjectTy, locator);
3472+
rootObjectTy = CS.openUnboundGenericTypes(rootObjectTy, locator);
34733473
// Allow \Derived.property to be inferred as \Base.property to
34743474
// simulate a sort of covariant conversion from
34753475
// KeyPath<Derived, T> to KeyPath<Base, T>.

lib/Sema/ConstraintSystem.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ ConstraintSystem::openUnboundGenericType(UnboundGenericType *unbound,
661661
auto unboundDecl = unbound->getDecl();
662662
auto parentTy = unbound->getParent();
663663
if (parentTy) {
664-
parentTy = openUnboundGenericType(parentTy, locator);
664+
parentTy = openUnboundGenericTypes(parentTy, locator);
665665
unbound = UnboundGenericType::get(unboundDecl, parentTy,
666666
getASTContext());
667667
}
@@ -782,7 +782,7 @@ static void checkNestedTypeConstraints(ConstraintSystem &cs, Type type,
782782
checkNestedTypeConstraints(cs, parentTy, locator);
783783
}
784784

785-
Type ConstraintSystem::openUnboundGenericType(
785+
Type ConstraintSystem::openUnboundGenericTypes(
786786
Type type, ConstraintLocatorBuilder locator) {
787787
assert(!type->getCanonicalType()->hasTypeParameter());
788788

@@ -1235,7 +1235,7 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
12351235
checkNestedTypeConstraints(*this, type, locator);
12361236

12371237
// Open the type.
1238-
type = openUnboundGenericType(type, locator);
1238+
type = openUnboundGenericTypes(type, locator);
12391239

12401240
// Module types are not wrapped in metatypes.
12411241
if (type->is<ModuleType>())
@@ -1491,7 +1491,7 @@ ConstraintSystem::getTypeOfMemberReference(
14911491
checkNestedTypeConstraints(*this, memberTy, locator);
14921492

14931493
// Open the type if it was a reference to a generic type.
1494-
memberTy = openUnboundGenericType(memberTy, locator);
1494+
memberTy = openUnboundGenericTypes(memberTy, locator);
14951495

14961496
// Wrap it in a metatype.
14971497
memberTy = MetatypeType::get(memberTy);

lib/Sema/ConstraintSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3420,7 +3420,7 @@ class ConstraintSystem {
34203420
/// \param type The type to open.
34213421
///
34223422
/// \returns The opened type.
3423-
Type openUnboundGenericType(Type type, ConstraintLocatorBuilder locator);
3423+
Type openUnboundGenericTypes(Type type, ConstraintLocatorBuilder locator);
34243424

34253425
/// "Open" the given type by replacing any occurrences of generic
34263426
/// parameter types and dependent member types with fresh type variables.

lib/Sema/TypeCheckPropertyWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ PropertyWrapperBackingPropertyTypeRequest::evaluate(
619619

620620
// Open the type.
621621
Type openedWrapperType =
622-
cs.openUnboundGenericType(rawWrapperType, emptyLocator);
622+
cs.openUnboundGenericTypes(rawWrapperType, emptyLocator);
623623
if (!outermostOpenedWrapperType)
624624
outermostOpenedWrapperType = openedWrapperType;
625625

0 commit comments

Comments
 (0)