Skip to content

Commit bddb40d

Browse files
committed
GSB: ignore generic types in expandConformanceRequirement
Fixes crashes in 28437-swift-typechecker-validatedecl.swift (from previous commit) and the compiler crasher 28861-gpdecl-getdepth-generictypeparamdecl- invaliddepth-parameter-hasnt-been-validated.swift.
1 parent c27dca3 commit bddb40d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4163,8 +4163,14 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
41634163
if (inheritedProto == proto) return TypeWalker::Action::Continue;
41644164

41654165
for (auto req : inheritedProto->getMembers()) {
4166-
if (auto typeReq = dyn_cast<TypeDecl>(req))
4166+
if (auto typeReq = dyn_cast<TypeDecl>(req)) {
4167+
// Ignore generic types
4168+
if (auto genReq = dyn_cast<GenericTypeDecl>(req))
4169+
if (genReq->getGenericParams())
4170+
continue;
4171+
41674172
inheritedTypeDecls[typeReq->getFullName()].push_back(typeReq);
4173+
}
41684174
}
41694175
return TypeWalker::Action::Continue;
41704176
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// REQUIRES: asserts
9-
// RUN: not --crash %target-swift-frontend %s -emit-ir
9+
// RUN: not %target-swift-frontend %s -emit-ir
1010
protocol
1111
P{protocol A:P{{}}typealias e:A{}class a<a{}class a

0 commit comments

Comments
 (0)