Skip to content

Commit cacd72f

Browse files
committed
[Runtime] Properly unique foreign witness tables.
The Name field of a type descriptor is not the appropriate way to compare types for uniquing. Instead, use TypeContextIdentity. Fixes rdar://problem/46685973.
1 parent d5f5ba6 commit cacd72f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdlib/public/runtime/Metadata.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3669,7 +3669,8 @@ namespace {
36693669
int compareWithKey(const Key other) const {
36703670
if (auto r = comparePointers(other.protocol, key.protocol))
36713671
return r;
3672-
return strcmp(other.type->Name.get(), key.type->Name.get());
3672+
3673+
return TypeContextIdentity(other.type).compare(TypeContextIdentity(key.type));
36733674
}
36743675

36753676
static size_t getExtraAllocationSize(const Key,

0 commit comments

Comments
 (0)