Skip to content

Commit dc35db6

Browse files
committed
[GenericEnvironment] Map shape types into context in PackArchetypeType::getShape.
1 parent ad962d8 commit dc35db6

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

include/swift/AST/Types.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6035,9 +6035,7 @@ class PackArchetypeType final
60356035
LayoutConstraint Layout);
60366036

60376037
// Returns the reduced shape type for this pack archetype.
6038-
Type getShape() const {
6039-
return getTrailingObjects<PackShape>()->shapeType;
6040-
}
6038+
Type getShape() const;
60416039

60426040
static bool classof(const TypeBase *T) {
60436041
return T->getKind() == TypeKind::PackArchetype;

lib/AST/Type.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3992,6 +3992,11 @@ PackArchetypeType::get(const ASTContext &Ctx,
39923992
{ShapeType}));
39933993
}
39943994

3995+
Type PackArchetypeType::getShape() const {
3996+
auto shapeType = getTrailingObjects<PackShape>()->shapeType;
3997+
return getGenericEnvironment()->mapTypeIntoContext(shapeType);
3998+
}
3999+
39954000
ElementArchetypeType::ElementArchetypeType(
39964001
const ASTContext &Ctx, GenericEnvironment *GenericEnv, Type InterfaceType,
39974002
ArrayRef<ProtocolDecl *> ConformsTo, Type Superclass,

lib/Sema/CSGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2897,7 +2897,7 @@ namespace {
28972897
return;
28982898

28992899
if (auto archetype = type->getAs<PackArchetypeType>()) {
2900-
shapeType = CS.DC->mapTypeIntoContext(archetype->getShape());
2900+
shapeType = archetype->getShape();
29012901
}
29022902
});
29032903

0 commit comments

Comments
 (0)