Skip to content

Commit 6e4c88d

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 bf1774b commit 6e4c88d

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
@@ -496,7 +496,8 @@ void TBDGenVisitor::addConformances(DeclContext *DC) {
496496
addSymbolIfNecessary(reqtAccessor, witnessAccessor);
497497
});
498498
} else if (isa<EnumElementDecl>(witnessDecl)) {
499-
addSymbolIfNecessary(valueReq, witnessDecl);
499+
auto getter = storage->getSynthesizedAccessor(AccessorKind::Get);
500+
addSymbolIfNecessary(getter, witnessDecl);
500501
}
501502
}
502503
});
@@ -1016,13 +1017,12 @@ void TBDGenVisitor::visitProtocolDecl(ProtocolDecl *PD) {
10161017

10171018
void TBDGenVisitor::visitEnumDecl(EnumDecl *ED) {
10181019
visitNominalTypeDecl(ED);
1019-
1020-
if (!ED->isResilient())
1021-
return;
10221020
}
10231021

10241022
void TBDGenVisitor::visitEnumElementDecl(EnumElementDecl *EED) {
1025-
addSymbol(LinkEntity::forEnumCase(EED));
1023+
if (EED->getParentEnum()->isResilient())
1024+
addSymbol(LinkEntity::forEnumCase(EED));
1025+
10261026
if (auto *PL = EED->getParameterList())
10271027
visitDefaultArguments(EED, PL);
10281028
}

0 commit comments

Comments
 (0)