SIL: Add forEachExpandedPackElement() and use it in type lowering

Probably there's no way to hit this right now, but there will be if
concrete formal PackTypes start showing up in AST.
This commit is contained in:
Slava Pestov
2023-07-19 14:57:02 -04:00
parent 8a07466938
commit 04fe8f4bc6
3 changed files with 20 additions and 10 deletions

View File

@@ -707,7 +707,7 @@ AbstractionPattern::getPackElementType(unsigned index) const {
llvm_unreachable("bad kind");
}
bool AbstractionPattern::matchesPack(CanPackType substType) {
bool AbstractionPattern::matchesPack(CanPackType substType) const {
switch (getKind()) {
case Kind::Invalid:
llvm_unreachable("querying invalid abstraction pattern!");
@@ -750,11 +750,11 @@ void AbstractionPattern::forEachPackElement(CanPackType substType,
elt.finish();
}
void AbstractionPattern::forEachExpandedPackElement(CanPackType substType,
void AbstractionPattern::forEachExpandedPackElement(CanPackType substPackType,
llvm::function_ref<void(AbstractionPattern origEltType,
CanType substEltType)>
handleElement) const {
assert(matchesPack(substType));
assert(matchesPack(substPackType));
auto substEltTypes = substPackType.getElementTypes();