mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CSSyntacticElement] Bring type variables from outer pack expansion into scope
If closure appears inside of a pack expansion, the elements that reference pack elements have to bring expansion's shape type in scope to make sure that the shapes match.
This commit is contained in:
@@ -153,6 +153,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// If closure appears inside of a pack expansion, the elements
|
||||
// that reference pack elements have to bring expansion's shape
|
||||
// type in scope to make sure that the shapes match.
|
||||
if (auto *packElement = getAsExpr<PackElementExpr>(expr)) {
|
||||
if (auto *outerEnvironment = CS.getPackEnvironment(packElement)) {
|
||||
auto *expansionTy = CS.simplifyType(CS.getType(outerEnvironment))
|
||||
->castTo<PackExpansionType>();
|
||||
expansionTy->getCountType()->getTypeVariables(ReferencedVars);
|
||||
}
|
||||
}
|
||||
|
||||
return Action::Continue(expr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user