|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library |
| 3 | +// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -module-name Library |
| 4 | +// RUN: %FileCheck %s < %t/Library.swiftinterface |
| 5 | + |
| 6 | +// CHECK-NOT: #if compiler(>=5.3) && $AlwaysInheritActorContext |
| 7 | +// CHECK: public func globalTest(@_inheritActorContext _: @Sendable () async -> Swift.Void) |
| 8 | +// CHECK-NOT: #endif |
| 9 | +public func globalTest(@_inheritActorContext _: @Sendable () async -> Void) {} |
| 10 | + |
| 11 | +// CHECK: #if compiler(>=5.3) && $AlwaysInheritActorContext |
| 12 | +// CHECK-NEXT: public func globalTestAlways(@_inheritActorContext(always) _: @Sendable () async -> Swift.Void) |
| 13 | +// CHECK-NEXT: #endif |
| 14 | +public func globalTestAlways(@_inheritActorContext(always) _: @Sendable () async -> Void) {} |
| 15 | + |
| 16 | +public struct Test { |
| 17 | + // CHECK-NOT: #if compiler(>=5.3) && $AlwaysInheritActorContext |
| 18 | + // CHECK: public init(@_inheritActorContext x: @Sendable () async -> Swift.Int) |
| 19 | + // CHECK-NOT: #endif |
| 20 | + public init(@_inheritActorContext x: @Sendable () async -> Int) {} |
| 21 | + |
| 22 | + // CHECK: #if compiler(>=5.3) && $AlwaysInheritActorContext |
| 23 | + // CHECK-NEXT: #if compiler(>=5.3) && $SendingArgsAndResults |
| 24 | + // CHECK-NEXT: public init(@_inheritActorContext(always) y: sending () async -> Swift.Void) |
| 25 | + // CHECK-NEXT: #else |
| 26 | + // CHECK-NEXT: public init(@_inheritActorContext(always) y: () async -> Swift.Void) |
| 27 | + // CHECK-NEXT: #endif |
| 28 | + // CHECK-NEXT: #endif |
| 29 | + public init(@_inheritActorContext(always) y: sending () async -> Void) {} |
| 30 | + |
| 31 | + // CHECK-NOT: #if compiler(>=5.3) && $AlwaysInheritActorContext |
| 32 | + // CHECK: public subscript(@_inheritActorContext _: @Sendable () async -> Swift.Void) -> Swift.Bool { |
| 33 | + // CHECK-NEXT: get |
| 34 | + // CHECK-NEXT: } |
| 35 | + // CHECK-NOT: #endif |
| 36 | + public subscript(@_inheritActorContext _: @Sendable () async -> Void) -> Bool { false } |
| 37 | + |
| 38 | + // CHECK: #if compiler(>=5.3) && $AlwaysInheritActorContext |
| 39 | + // CHECK-NEXT: public subscript(@_inheritActorContext(always) _: @Sendable (Swift.Int) async -> Swift.Void) -> Swift.Bool { |
| 40 | + // CHECK-NEXT: get |
| 41 | + // CHECK-NEXT: } |
| 42 | + public subscript(@_inheritActorContext(always) _: @Sendable (Int) async -> Void) -> Bool { false } |
| 43 | +} |
0 commit comments