Skip to content

Commit fc1ad79

Browse files
committed
[NFC] ConstraintSystem: Rename openExistentialType to openAnyExistentialType
This method can open an existential metatype too, and we already use `isAnyExistentialType` to mean "existential type or existential metatype"
1 parent 55189ba commit fc1ad79

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,10 +3277,11 @@ class ConstraintSystem {
32773277
ConstraintLocator *getOpenOpaqueLocator(
32783278
ConstraintLocatorBuilder locator, OpaqueTypeDecl *opaqueDecl);
32793279

3280-
/// Open the given existential type, recording the opened type in the
3281-
/// constraint system and returning both it and the root opened archetype.
3282-
std::pair<Type, OpenedArchetypeType *> openExistentialType(
3283-
Type type, ConstraintLocator *locator);
3280+
/// Open the given existential type or existential metatype, recording the
3281+
/// opened archetype in the constraint system and returning both the opened
3282+
/// type and opened archetype.
3283+
std::pair<Type, OpenedArchetypeType *>
3284+
openAnyExistentialType(Type type, ConstraintLocator *locator);
32843285

32853286
/// Update OpenedExistentials and record a change in the trail.
32863287
void recordOpenedExistentialType(ConstraintLocator *locator,

lib/Sema/CSSimplify.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
18251825
std::tie(openedTypeVar, existentialType, adjustments) = *existentialArg;
18261826

18271827
OpenedArchetypeType *opened;
1828-
std::tie(argTy, opened) = cs.openExistentialType(
1828+
std::tie(argTy, opened) = cs.openAnyExistentialType(
18291829
existentialType, cs.getConstraintLocator(loc));
18301830

18311831
if (adjustments.contains(OpenedExistentialAdjustmentFlags::LValue))
@@ -8647,7 +8647,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
86478647
if (type->isExistentialType()) {
86488648
if (auto elt = loc->getLastElementAs<LocatorPathElt::ContextualType>()) {
86498649
if (elt->getPurpose() == CTP_ForEachSequence) {
8650-
type = openExistentialType(type, loc).first;
8650+
type = openAnyExistentialType(type, loc).first;
86518651
}
86528652
}
86538653
}
@@ -12430,8 +12430,8 @@ ConstraintSystem::simplifyOpenedExistentialOfConstraint(
1243012430
if (type2->isAnyExistentialType()) {
1243112431
// We have the existential side. Produce an opened archetype and bind
1243212432
// type1 to it.
12433-
Type openedTy = openExistentialType(type2, getConstraintLocator(locator))
12434-
.first;
12433+
Type openedTy =
12434+
openAnyExistentialType(type2, getConstraintLocator(locator)).first;
1243512435
return matchTypes(type1, openedTy, ConstraintKind::Bind, subflags, locator);
1243612436
}
1243712437
if (!type2->isTypeVariableOrMember())

lib/Sema/ConstraintSystem.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,9 @@ ConstraintLocator *ConstraintSystem::getOpenOpaqueLocator(
853853
{ LocatorPathElt::OpenedOpaqueArchetype(opaqueDecl) }, 0);
854854
}
855855

856-
std::pair<Type, OpenedArchetypeType *> ConstraintSystem::openExistentialType(
857-
Type type, ConstraintLocator *locator) {
856+
std::pair<Type, OpenedArchetypeType *>
857+
ConstraintSystem::openAnyExistentialType(Type type,
858+
ConstraintLocator *locator) {
858859
Type result = OpenedArchetypeType::getAny(type);
859860
Type t = result;
860861
while (t->is<MetatypeType>())

0 commit comments

Comments
 (0)