Skip to content

Commit 7987cdc

Browse files
committed
SILGenPattern: Remove the formal/actual element distinction
This used to model the difference between Optional.some and IUO.some, but that's gone now! No functionality change.
1 parent efe9d51 commit 7987cdc

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/SILGen/SILGenPattern.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,10 +1690,9 @@ void PatternMatchEmission::emitIsDispatch(ArrayRef<RowToSpecialize> rows,
16901690

16911691
namespace {
16921692
struct CaseInfo {
1693-
EnumElementDecl *FormalElement;
1693+
SmallVector<SpecializedRow, 2> SpecializedRows;
16941694
Pattern *FirstMatcher;
16951695
bool Irrefutable = false;
1696-
SmallVector<SpecializedRow, 2> SpecializedRows;
16971696
};
16981697

16991698
class CaseBlocks {
@@ -1773,7 +1772,6 @@ CaseBlocks::CaseBlocks(
17731772
curBB = SGF.createBasicBlock(curBB);
17741773
CaseBBs.push_back({formalElt, curBB});
17751774
CaseInfos.push_back(CaseInfo());
1776-
CaseInfos.back().FormalElement = formalElt;
17771775
CaseInfos.back().FirstMatcher = row.Pattern;
17781776
CaseCounts.push_back(row.Count);
17791777
}
@@ -1852,7 +1850,6 @@ void PatternMatchEmission::emitEnumElementDispatchWithOwnership(
18521850
const CaseInfo &caseInfo) {
18531851
SILLocation loc = caseInfo.FirstMatcher;
18541852
auto &specializedRows = caseInfo.SpecializedRows;
1855-
EnumElementDecl *formalElt = caseInfo.FormalElement;
18561853

18571854
SGF.B.setInsertionPoint(caseBB);
18581855

@@ -1927,8 +1924,8 @@ void PatternMatchEmission::emitEnumElementDispatchWithOwnership(
19271924

19281925
CanType substEltTy =
19291926
sourceType
1930-
->getTypeOfMember(SGF.SGM.M.getSwiftModule(), formalElt,
1931-
formalElt->getArgumentInterfaceType())
1927+
->getTypeOfMember(SGF.SGM.M.getSwiftModule(), elt,
1928+
elt->getArgumentInterfaceType())
19321929
->getCanonicalType();
19331930

19341931
AbstractionPattern origEltTy =
@@ -2014,7 +2011,6 @@ void PatternMatchEmission::emitEnumElementDispatch(
20142011
const CaseInfo &caseInfo) {
20152012
SILLocation loc = caseInfo.FirstMatcher;
20162013
auto &specializedRows = caseInfo.SpecializedRows;
2017-
EnumElementDecl *formalElt = caseInfo.FormalElement;
20182014

20192015
SGF.B.setInsertionPoint(caseBB);
20202016

@@ -2137,8 +2133,8 @@ void PatternMatchEmission::emitEnumElementDispatch(
21372133
// Reabstract to the substituted type, if needed.
21382134

21392135
CanType substEltTy =
2140-
sourceType->getTypeOfMember(SGF.SGM.M.getSwiftModule(), formalElt,
2141-
formalElt->getArgumentInterfaceType())
2136+
sourceType->getTypeOfMember(SGF.SGM.M.getSwiftModule(), elt,
2137+
elt->getArgumentInterfaceType())
21422138
->getCanonicalType();
21432139

21442140
AbstractionPattern origEltTy =

0 commit comments

Comments
 (0)