File tree Expand file tree Collapse file tree 4 files changed +34
-7
lines changed Expand file tree Collapse file tree 4 files changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
233
233
234
234
// Native function-local declarations have shared linkage.
235
235
// FIXME: @objc declarations should be too, but we currently have no way
236
- // of marking them "used" other than making them external.
236
+ // of marking them "used" other than making them external.
237
237
ValueDecl *d = getDecl ();
238
238
DeclContext *moduleContext = d->getDeclContext ();
239
239
while (!moduleContext->isModuleScopeContext ()) {
@@ -335,6 +335,10 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
335
335
}
336
336
}
337
337
338
+ if (isEnumElement ()) {
339
+ limit = Limit::OnDemand;
340
+ }
341
+
338
342
auto effectiveAccess = d->getEffectiveAccess ();
339
343
340
344
// Private setter implementations for an internal storage declaration should
Original file line number Diff line number Diff line change @@ -498,7 +498,8 @@ void TBDGenVisitor::addConformances(const IterableDeclContext *IDC) {
498
498
addSymbolIfNecessary (reqtAccessor, witnessAccessor);
499
499
});
500
500
} else if (isa<EnumElementDecl>(witnessDecl)) {
501
- addSymbolIfNecessary (valueReq, witnessDecl);
501
+ auto getter = storage->getSynthesizedAccessor (AccessorKind::Get);
502
+ addSymbolIfNecessary (getter, witnessDecl);
502
503
}
503
504
}
504
505
});
@@ -1018,13 +1019,12 @@ void TBDGenVisitor::visitProtocolDecl(ProtocolDecl *PD) {
1018
1019
1019
1020
void TBDGenVisitor::visitEnumDecl (EnumDecl *ED) {
1020
1021
visitNominalTypeDecl (ED);
1021
-
1022
- if (!ED->isResilient ())
1023
- return ;
1024
1022
}
1025
1023
1026
1024
void TBDGenVisitor::visitEnumElementDecl (EnumElementDecl *EED) {
1027
- addSymbol (LinkEntity::forEnumCase (EED));
1025
+ if (EED->getParentEnum ()->isResilient ())
1026
+ addSymbol (LinkEntity::forEnumCase (EED));
1027
+
1028
1028
if (auto *PL = EED->getParameterList ())
1029
1029
visitDefaultArguments (EED, PL);
1030
1030
}
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ enum AnotherBar: AnotherFoo {
26
26
// CHECK-NEXT: return [[TUPLE]] : $()
27
27
// CHECK-END: }
28
28
29
- // CHECK-LABEL: sil hidden [transparent] [ossa] @$s21protocol_enum_witness3BarO6buttonyA2CmF : $@convention(method) (@thin Bar.Type) -> Bar {
29
+ // CHECK-LABEL: sil shared [transparent] [ossa] @$s21protocol_enum_witness3BarO6buttonyA2CmF : $@convention(method) (@thin Bar.Type) -> Bar {
30
30
// CHECK: bb0({{%.*}} : $@thin Bar.Type):
31
31
// CHECK-NEXT: [[CASE:%.*]] = enum $Bar, #Bar.button!enumelt
32
32
// CHECK-NEXT: return [[CASE]] : $Bar
Original file line number Diff line number Diff line change
1
+ // REQUIRES: VENDOR=apple
2
+ // RUN: %target-swift-frontend -emit-ir -enable-testing -o/dev/null -module-name test -validate-tbd-against-ir=all %s
3
+ // RUN: %target-swift-frontend -emit-ir -o/dev/null -module-name test -validate-tbd-against-ir=all %s
4
+
5
+ protocol ProtoInternal {
6
+ static var bar1 : Self { get }
7
+ static func bar2( arg: Int ) -> Self
8
+ }
9
+
10
+ enum EnumInternal : ProtoInternal {
11
+ case bar1
12
+ case bar2( arg: Int )
13
+ }
14
+
15
+ public protocol ProtoPublic {
16
+ static var bar3 : Self { get }
17
+ static func bar4( arg: Int ) -> Self
18
+ }
19
+
20
+ public enum EnumPublic : ProtoPublic {
21
+ case bar3
22
+ case bar4( arg: Int )
23
+ }
You can’t perform that action at this time.
0 commit comments