Skip to content

Commit 8d30645

Browse files
committed
AST: Use hasPrimaryArchetype() in a few places
1 parent 4597cc3 commit 8d30645

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8144,7 +8144,7 @@ Type VarDecl::getPropertyWrapperInitValueInterfaceType() const {
81448144
return Type();
81458145

81468146
Type valueInterfaceTy = initInfo.getWrappedValuePlaceholder()->getType();
8147-
if (valueInterfaceTy->hasArchetype())
8147+
if (valueInterfaceTy->hasPrimaryArchetype())
81488148
valueInterfaceTy = valueInterfaceTy->mapTypeOutOfContext();
81498149

81508150
return valueInterfaceTy;

lib/AST/GenericEnvironment.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,11 @@ GenericEnvironment::maybeApplyOuterContextSubstitutions(Type type) const {
404404

405405
Type GenericEnvironment::mapTypeIntoContext(GenericEnvironment *env,
406406
Type type) {
407-
assert((!type->hasArchetype() || type->hasLocalArchetype()) &&
408-
"already have a contextual type");
409-
assert((env || !type->hasTypeParameter()) &&
410-
"no generic environment provided for type with type parameters");
407+
assert(!type->hasPrimaryArchetype() && "already have a contextual type");
411408

412409
if (!env) {
410+
assert(!type->hasTypeParameter() &&
411+
"no generic environment provided for type with type parameters");
413412
return type;
414413
}
415414

@@ -632,8 +631,7 @@ Type QueryInterfaceTypeSubstitutions::operator()(SubstitutableType *type) const{
632631
Type GenericEnvironment::mapTypeIntoContext(
633632
Type type,
634633
LookupConformanceFn lookupConformance) const {
635-
assert((!type->hasArchetype() || type->hasLocalArchetype()) &&
636-
"already have a contextual type");
634+
assert(!type->hasPrimaryArchetype() && "already have a contextual type");
637635

638636
Type result = type.subst(QueryInterfaceTypeSubstitutions(this),
639637
lookupConformance,
@@ -668,7 +666,7 @@ GenericEnvironment::mapContextualPackTypeIntoElementContext(Type type) const {
668666
assert(getKind() == Kind::OpenedElement);
669667
assert(!type->hasTypeParameter() && "expected contextual type");
670668

671-
if (!type->hasArchetype()) return type;
669+
if (!type->hasPackArchetype()) return type;
672670

673671
auto sig = getGenericSignature();
674672
auto shapeClass = getOpenedElementShapeClass();
@@ -698,9 +696,9 @@ GenericEnvironment::mapContextualPackTypeIntoElementContext(CanType type) const
698696
Type
699697
GenericEnvironment::mapPackTypeIntoElementContext(Type type) const {
700698
assert(getKind() == Kind::OpenedElement);
701-
assert(!type->hasArchetype());
699+
assert(!type->hasPackArchetype());
702700

703-
if (!type->hasTypeParameter()) return type;
701+
if (!type->hasParameterPack()) return type;
704702

705703
// Get a contextual type in the original generic environment, not the
706704
// substituted one, which is what mapContextualPackTypeIntoElementContext()

0 commit comments

Comments
 (0)