Skip to content

Commit 9d22db4

Browse files
committed
Profile and dump the ordinal of OpaqueTypeArchetypeType.
The "profile" of OpaqueTypeArchetypeType didn't contain the ordinal, so multiple opaque types would collide.
1 parent 73ae727 commit 9d22db4

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

include/swift/AST/Types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5605,10 +5605,11 @@ class OpaqueTypeArchetypeType final : public ArchetypeType,
56055605

56065606
static void Profile(llvm::FoldingSetNodeID &ID,
56075607
OpaqueTypeDecl *OpaqueDecl,
5608+
unsigned ordinal,
56085609
SubstitutionMap Substitutions);
56095610

56105611
void Profile(llvm::FoldingSetNodeID &ID) {
5611-
Profile(ID, getDecl(), getSubstitutions());
5612+
Profile(ID, getDecl(), getOrdinal(), getSubstitutions());
56125613
};
56135614

56145615
private:

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4283,7 +4283,7 @@ OpaqueTypeArchetypeType::get(OpaqueTypeDecl *Decl, unsigned ordinal,
42834283
Substitutions = Substitutions.getCanonical();
42844284

42854285
llvm::FoldingSetNodeID id;
4286-
Profile(id, Decl, Substitutions);
4286+
Profile(id, Decl, ordinal, Substitutions);
42874287

42884288
auto &ctx = Decl->getASTContext();
42894289

lib/AST/ASTDumper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3776,6 +3776,7 @@ namespace {
37763776
StringRef label) {
37773777
printArchetypeCommon(T, "opaque_type", label);
37783778
printField("decl", T->getDecl()->getNamingDecl()->printRef());
3779+
printField("ordinal", T->getOrdinal());
37793780
if (!T->getSubstitutions().empty()) {
37803781
OS << '\n';
37813782
SmallPtrSet<const ProtocolConformance *, 4> Dumped;

lib/AST/Type.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3781,8 +3781,10 @@ std::string ArchetypeType::getFullName() const {
37813781
void
37823782
OpaqueTypeArchetypeType::Profile(llvm::FoldingSetNodeID &id,
37833783
OpaqueTypeDecl *decl,
3784+
unsigned ordinal,
37843785
SubstitutionMap subs) {
37853786
id.AddPointer(decl);
3787+
id.AddInteger(ordinal);
37863788
subs.profile(id);
37873789
}
37883790

0 commit comments

Comments
 (0)