Skip to content

Commit feea23d

Browse files
committed
AST: Use transformTypeParameterPacks() in getOpenedElementSignature()
1 parent b834493 commit feea23d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lib/AST/ASTContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5856,13 +5856,13 @@ ASTContext::getOpenedElementSignature(CanGenericSignature baseGenericSig,
58565856
}
58575857

58585858
auto eraseParameterPackRec = [&](Type type) -> Type {
5859-
return type.transformRec([&](Type t) -> llvm::Optional<Type> {
5860-
if (auto *paramType = t->getAs<GenericTypeParamType>()) {
5859+
return type.transformTypeParameterPacks([&](SubstitutableType *t) -> llvm::Optional<Type> {
5860+
if (auto *paramType = dyn_cast<GenericTypeParamType>(t)) {
58615861
if (packElementParams.find(paramType) != packElementParams.end()) {
58625862
return Type(packElementParams[paramType]);
58635863
}
58645864

5865-
return t;
5865+
return Type(t);
58665866
}
58675867
return llvm::None;
58685868
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %target-swift-frontend -emit-ir %s -disable-availability-checking
2+
3+
public protocol P {
4+
associatedtype A
5+
}
6+
7+
public struct G<each T> {}
8+
9+
public struct S<T: P, each U: P> where repeat T.A == G<repeat each U> {
10+
public init(predicate: repeat each U) {}
11+
}
12+

0 commit comments

Comments
 (0)