Skip to content

Commit f66b57c

Browse files
authored
Merge pull request #71666 from mikeash/libprespecialize-no-packs
[Runtime] Skip types with pack parameters in LibPrespecialized.
2 parents 99507e3 + dba0859 commit f66b57c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

stdlib/public/runtime/LibPrespecialized.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ const LibPrespecializedData<InProcess> *swift::getLibPrespecializedData() {
7272
return SWIFT_LAZY_CONSTANT(findLibPrespecialized());
7373
}
7474

75+
// Returns true if the type has any arguments that aren't plain types (packs or
76+
// unknown kinds).
77+
static bool hasNonTypeGenericArguments(const TypeContextDescriptor *description) {
78+
auto generics = description->getGenericContext();
79+
if (!generics)
80+
return false;
81+
82+
for (auto param : generics->getGenericParams())
83+
if (param.getKind() != GenericParamKind::Type)
84+
return true;
85+
86+
return false;
87+
}
88+
7589
static bool disableForValidation = false;
7690

7791
Metadata *
@@ -84,6 +98,11 @@ swift::getLibPrespecializedMetadata(const TypeContextDescriptor *description,
8498
if (!data)
8599
return nullptr;
86100

101+
// We don't support types with pack parameters yet (and especially not types
102+
// with unknown parameter kinds) so don't even try to look those up.
103+
if (hasNonTypeGenericArguments(description))
104+
return nullptr;
105+
87106
Demangler dem;
88107
auto mangleNode = _buildDemanglingForGenericType(description, arguments, dem);
89108
if (!mangleNode) {

0 commit comments

Comments
 (0)