File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -750,6 +750,9 @@ void SILGenFunction::emitEnumConstructor(EnumElementDecl *element) {
750
750
auto &enumTI =
751
751
SGM.Types .getTypeLowering (enumTy, TypeExpansionContext::minimal ());
752
752
753
+ if (shouldLowerToUnavailableCodeStub (element))
754
+ emitApplyOfUnavailableCodeReached ();
755
+
753
756
RegularLocation Loc (element);
754
757
CleanupLocation CleanupLoc (element);
755
758
Loc.markAutoGenerated ();
Original file line number Diff line number Diff line change @@ -4966,6 +4966,9 @@ void SILGenFunction::emitProtocolWitness(
4966
4966
SmallVector<ManagedValue, 8 > origParams;
4967
4967
collectThunkParams (loc, origParams);
4968
4968
4969
+ if (shouldLowerToUnavailableCodeStub (witness.getDecl ()))
4970
+ emitApplyOfUnavailableCodeReached ();
4971
+
4969
4972
if (enterIsolation) {
4970
4973
// If we are supposed to enter the actor, do so now by hopping to the
4971
4974
// actor.
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-emit-silgen -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub | %FileCheck %s --check-prefixes=CHECK
2
+
3
+ public struct S { }
4
+
5
+ public protocol P {
6
+ static func requirement( _ s: S ) -> Self
7
+ }
8
+
9
+ public enum EnumWithProtocolWitness {
10
+ @available ( * , unavailable)
11
+ case requirement( _ s: S )
12
+ }
13
+
14
+ @available ( * , unavailable)
15
+ extension EnumWithProtocolWitness : P { }
16
+
17
+ // protocol witness for static P.requirement(_:) in conformance EnumWithProtocolWitness
18
+ //
19
+ // CHECK-LABEL: sil {{.*}} @$s4Test23EnumWithProtocolWitnessOAA1PA2aDP11requirementyxAA1SVFZTW
20
+ // CHECK: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF
21
+ // CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
22
+ // CHECK: {{%.*}} = function_ref @$s4Test23EnumWithProtocolWitnessO11requirementyAcA1SVcACmF
23
+ // CHECK: } // end sil function '$s4Test23EnumWithProtocolWitnessOAA1PA2aDP11requirementyxAA1SVFZTW'
24
+ //
25
+ // EnumWithProtocolWitness.requirement(_:)
26
+ //
27
+ // CHECK-LABEL: sil {{.*}} @$s4Test23EnumWithProtocolWitnessO11requirementyAcA1SVcACmF
28
+ // CHECK: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF
29
+ // CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
30
+ // CHECK: enum $EnumWithProtocolWitness, #EnumWithProtocolWitness.requirement!enumelt
31
+ // CHECK: } // end sil function '$s4Test23EnumWithProtocolWitnessO11requirementyAcA1SVcACmF'
You can’t perform that action at this time.
0 commit comments