|
6 | 6 | // REQUIRES: concurrency |
7 | 7 |
|
8 | 8 | public struct Test { |
9 | | - // CHECK: nonisolated(nonsending) public init() async |
| 9 | + // CHECK: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 10 | + // CHECK-NEXT: nonisolated(nonsending) public init() async |
| 11 | + // CHECK-NEXT: #endif |
10 | 12 | nonisolated(nonsending) |
11 | 13 | public init() async { |
12 | 14 | } |
13 | 15 |
|
14 | | - // CHECK: @concurrent public func test() async |
| 16 | + // CHECK: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 17 | + // CHECK-NEXT: @concurrent public init(something: Swift.Int) async |
| 18 | + // CHECK-NEXT: #endif |
| 19 | + @concurrent |
| 20 | + public init(something: Int) async { |
| 21 | + } |
| 22 | + |
| 23 | + // CHECK-NOT: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 24 | + // CHECK: public init(noExplicit: Swift.String) async |
| 25 | + // CHECK-NOT: #endif |
| 26 | + public init(noExplicit: String) async { |
| 27 | + } |
| 28 | + |
| 29 | + // CHECK: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 30 | + // CHECK-NEXT: @concurrent public func test() async |
| 31 | + // CHECK-NEXT: #endif |
15 | 32 | @concurrent |
16 | 33 | public func test() async { |
17 | 34 | } |
18 | 35 |
|
19 | | - // CHECK: public func other(_: nonisolated(nonsending) () async -> Swift.Void) |
| 36 | + // CHECK: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 37 | + // CHECK-NEXT: public func other(_: nonisolated(nonsending) () async -> Swift.Void) |
| 38 | + // CHECK-NEXT: #endif |
20 | 39 | public func other(_: nonisolated(nonsending) () async -> Void) {} |
21 | 40 |
|
22 | | - // CHECK: nonisolated(nonsending) public var testOnVar: Swift.Int { |
| 41 | + // CHECK-NOT: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 42 | + // CHECK: public func concurrentResult(_: () async -> Swift.Void) -> (Swift.Int) async -> Swift.Void |
| 43 | + // CHECK-NOT: #endif |
| 44 | + public func concurrentResult(_: () async -> Void) -> @concurrent (Int) async -> Void {} |
| 45 | + |
| 46 | + // CHECK: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 47 | + // CHECK-NEXT: public func nestedPositions1(_: Swift.Array<[Swift.String : nonisolated(nonsending) (Swift.Int) async -> Swift.Void]>) |
| 48 | + // CHECK-NEXT: #endif |
| 49 | + public func nestedPositions1(_: Array<[String: nonisolated(nonsending) (Int) async -> Void]>) {} |
| 50 | + |
| 51 | + // CHECK-NOT: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 52 | + // CHECK: public func nestedPositions2(_: Swift.Array<[Swift.String : (Swift.Int) async -> Swift.Void]>) |
| 53 | + // CHECK-NOT: #endif |
| 54 | + public func nestedPositions2(_: Array<[String: @concurrent (Int) async -> Void]>) {} |
| 55 | + |
| 56 | + // CHECK: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 57 | + // CHECK-NEXT: nonisolated(nonsending) public var testOnVar: Swift.Int { |
23 | 58 | // CHECK-NEXT: get async |
24 | 59 | // CHECK-NEXT: } |
| 60 | + // CHECK-NEXT: #endif |
25 | 61 | nonisolated(nonsending) |
26 | 62 | public var testOnVar: Int { |
27 | 63 | get async { |
28 | 64 | 42 |
29 | 65 | } |
30 | 66 | } |
31 | 67 |
|
32 | | - // CHECK: nonisolated(nonsending) public subscript(onSubscript _: Swift.Int) -> Swift.Bool { |
| 68 | + // CHECK: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 69 | + // CHECK-NEXT: @concurrent public var testOnVarConcurrent: Swift.Int { |
| 70 | + // CHECK-NEXT: get async |
| 71 | + // CHECK-NEXT: } |
| 72 | + // CHECK-NEXT: #endif |
| 73 | + @concurrent |
| 74 | + public var testOnVarConcurrent: Int { |
| 75 | + get async { |
| 76 | + 42 |
| 77 | + } |
| 78 | + } |
| 79 | + |
| 80 | + // CHECK: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 81 | + // CHECK-NEXT: nonisolated(nonsending) public subscript(onSubscript _: Swift.Int) -> Swift.Bool { |
33 | 82 | // CHECK-NEXT: get async |
34 | 83 | // CHECK-NEXT: } |
| 84 | + // CHECK-NEXT: #endif |
35 | 85 | nonisolated(nonsending) |
36 | 86 | public subscript(onSubscript _: Int) -> Bool { |
37 | 87 | get async { |
38 | 88 | false |
39 | 89 | } |
40 | 90 | } |
| 91 | + |
| 92 | + // CHECK: #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes |
| 93 | + // CHECK-NEXT: @concurrent public subscript(concurrentOnSubscript _: Swift.Int) -> Swift.Bool { |
| 94 | + // CHECK-NEXT: get async |
| 95 | + // CHECK-NEXT: } |
| 96 | + // CHECK-NEXT: #endif |
| 97 | + @concurrent |
| 98 | + public subscript(concurrentOnSubscript _: Int) -> Bool { |
| 99 | + get async { |
| 100 | + false |
| 101 | + } |
| 102 | + } |
41 | 103 | } |
42 | 104 |
|
0 commit comments