Skip to content

Commit da8de56

Browse files
committed
NCGenerics: remove ArcheType::hasRequirements
The IDE's use isn't correct under noncopyable generics and only the constraint solver uses it. It's a misleading method now that nearly every archetype has Copyable/Escapable requirements.
1 parent 3486e46 commit da8de56

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

include/swift/AST/Types.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6405,11 +6405,6 @@ class ArchetypeType : public SubstitutableType,
64056405
return *getSubclassTrailingObjects<LayoutConstraint>();
64066406
}
64076407

6408-
/// Return true if the archetype has any requirements at all.
6409-
bool hasRequirements() const {
6410-
return !getConformsTo().empty() || getSuperclass();
6411-
}
6412-
64136408
/// Retrieve the nested type with the given associated type.
64146409
Type getNestedType(AssociatedTypeDecl *assocType);
64156410

lib/IDE/CodeCompletionResultType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ static TypeRelation calculateTypeRelation(Type Ty, Type ExpectedTy,
396396
bool isAny = false;
397397
isAny |= ExpectedTy->isAny();
398398
isAny |= ExpectedTy->is<ArchetypeType>() &&
399-
!ExpectedTy->castTo<ArchetypeType>()->hasRequirements();
399+
ExpectedTy->castTo<ArchetypeType>()->getExistentialType()->isAny();
400400

401401
if (!isAny && isConvertibleTo(Ty, ExpectedTy, /*openArchetypes=*/true,
402402
const_cast<DeclContext &>(DC)))

lib/Sema/CSApply.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ static bool isOpenedAnyObject(Type type) {
7878
return false;
7979

8080
return (archetype->requiresClass() &&
81-
!archetype->hasRequirements());
81+
archetype->getConformsTo().empty() &&
82+
!archetype->getSuperclass());
8283
}
8384

8485
SubstitutionMap

0 commit comments

Comments
 (0)