Skip to content

Commit 233b9a3

Browse files
committed
[TBDGen] Emit case symbols only if enum is resilient and some other fixes
(1) Pass property getter as requirement when the witness is an payload-less enum case (2) Remove dead code from visitEnumDecl
1 parent 14a2d26 commit 233b9a3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/TBDGen/TBDGen.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ void TBDGenVisitor::addConformances(const IterableDeclContext *IDC) {
498498
addSymbolIfNecessary(reqtAccessor, witnessAccessor);
499499
});
500500
} else if (isa<EnumElementDecl>(witnessDecl)) {
501-
addSymbolIfNecessary(valueReq, witnessDecl);
501+
auto getter = storage->getSynthesizedAccessor(AccessorKind::Get);
502+
addSymbolIfNecessary(getter, witnessDecl);
502503
}
503504
}
504505
});
@@ -1018,13 +1019,12 @@ void TBDGenVisitor::visitProtocolDecl(ProtocolDecl *PD) {
10181019

10191020
void TBDGenVisitor::visitEnumDecl(EnumDecl *ED) {
10201021
visitNominalTypeDecl(ED);
1021-
1022-
if (!ED->isResilient())
1023-
return;
10241022
}
10251023

10261024
void TBDGenVisitor::visitEnumElementDecl(EnumElementDecl *EED) {
1027-
addSymbol(LinkEntity::forEnumCase(EED));
1025+
if (EED->getParentEnum()->isResilient())
1026+
addSymbol(LinkEntity::forEnumCase(EED));
1027+
10281028
if (auto *PL = EED->getParameterList())
10291029
visitDefaultArguments(EED, PL);
10301030
}

0 commit comments

Comments
 (0)