File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -466,6 +466,12 @@ static bool usesFeatureBuiltinEmplaceTypedThrows(Decl *decl) {
466466}
467467
468468static bool usesFeatureExecutionAttribute (Decl *decl) {
469+ if (auto *ASD = dyn_cast<AbstractStorageDecl>(decl)) {
470+ if (auto *getter = ASD->getAccessor (AccessorKind::Get))
471+ return usesFeatureExecutionAttribute (getter);
472+ return false ;
473+ }
474+
469475 if (decl->getAttrs ().hasAttribute <ExecutionAttr>())
470476 return true ;
471477
Original file line number Diff line number Diff line change 66// REQUIRES: swift_feature_ExecutionAttribute
77
88public struct Test {
9+ // CHECK: #if compiler(>=5.3) && $ExecutionAttribute
10+ // CHECK-NEXT: @execution(caller) public init() async
11+ // CHECK-NEXT: #else
12+ // CHECK-NEXT: public init() async
13+ // CHECK-NEXT: #endif
14+ @execution ( caller)
15+ public init ( ) async {
16+ }
17+
918 // CHECK: #if compiler(>=5.3) && $ExecutionAttribute
1019 // CHECK-NEXT: @execution(concurrent) public func test() async
1120 // CHECK-NEXT: #else
@@ -21,5 +30,37 @@ public struct Test {
2130 // CHECK-NEXT: public func other(_: () async -> Swift.Void)
2231 // CHECK-NEXT: #endif
2332 public func other( _: @execution ( caller) ( ) async -> Void ) { }
33+
34+ // CHECK: #if compiler(>=5.3) && $ExecutionAttribute
35+ // CHECK-NEXT: public var test: Swift.Int {
36+ // CHECK-NEXT: @execution(caller) get async
37+ // CHECK-NEXT: }
38+ // CHECK-NEXT: #else
39+ // CHECK-NEXT: public var test: Swift.Int {
40+ // CHECK-NEXT: get async
41+ // CHECK-NEXT: }
42+ // CHECK-NEXT: #endif
43+ public var test : Int {
44+ @execution ( caller)
45+ get async {
46+ 42
47+ }
48+ }
49+
50+ // CHECK: #if compiler(>=5.3) && $ExecutionAttribute
51+ // CHECK-NEXT: public subscript(x: Swift.Int) -> Swift.Bool {
52+ // CHECK-NEXT: @execution(caller) get async
53+ // CHECK-NEXT: }
54+ // CHECK-NEXT: #else
55+ // CHECK-NEXT: public subscript(x: Swift.Int) -> Swift.Bool {
56+ // CHECK-NEXT: get async
57+ // CHECK-NEXT: }
58+ // CHECK-NEXT: #endif
59+ public subscript( x: Int ) -> Bool {
60+ @execution ( caller)
61+ get async {
62+ false
63+ }
64+ }
2465}
2566
You can’t perform that action at this time.
0 commit comments