Files
swift-mirror/test/ModuleInterface/inheritActorContext_attr.swift
Becca Royal-Gordon 1f008fb0d0 [ModuleInterface] Enable module selectors by default
And update tests to use them.

This commit depends on fixes in swiftlang/swift PRs #86905, #87129, and #87130.

Fixes rdar://169749886.
2026-02-20 00:35:23 -08:00

40 lines
2.0 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -module-name Library
// RUN: %FileCheck %s < %t/Library.swiftinterface
// CHECK-NOT: #if compiler(>=5.3) && $AlwaysInheritActorContext
// CHECK: public func globalTest(@_inheritActorContext _: @Sendable () async -> Swift::Void)
// CHECK-NOT: #endif
public func globalTest(@_inheritActorContext _: @Sendable () async -> Void) {}
// CHECK: #if compiler(>=5.3) && $AlwaysInheritActorContext
// CHECK-NEXT: public func globalTestAlways(@_inheritActorContext(always) _: @Sendable () async -> Swift::Void)
// CHECK-NEXT: #endif
public func globalTestAlways(@_inheritActorContext(always) _: @Sendable () async -> Void) {}
public struct Test {
// CHECK-NOT: #if compiler(>=5.3) && $AlwaysInheritActorContext
// CHECK: public init(@_inheritActorContext x: @Sendable () async -> Swift::Int)
// CHECK-NOT: #endif
public init(@_inheritActorContext x: @Sendable () async -> Int) {}
// CHECK: #if compiler(>=5.3) && $AlwaysInheritActorContext
// CHECK-NEXT: public init(@_inheritActorContext(always) y: sending () async -> Swift::Void)
// CHECK-NEXT: #endif
public init(@_inheritActorContext(always) y: sending () async -> Void) {}
// CHECK-NOT: #if compiler(>=5.3) && $AlwaysInheritActorContext
// CHECK: public subscript(@_inheritActorContext _: @Sendable () async -> Swift::Void) -> Swift::Bool {
// CHECK-NEXT: get
// CHECK-NEXT: }
// CHECK-NOT: #endif
public subscript(@_inheritActorContext _: @Sendable () async -> Void) -> Bool { false }
// CHECK: #if compiler(>=5.3) && $AlwaysInheritActorContext
// CHECK-NEXT: public subscript(@_inheritActorContext(always) _: @Sendable (Swift::Int) async -> Swift::Void) -> Swift::Bool {
// CHECK-NEXT: get
// CHECK-NEXT: }
public subscript(@_inheritActorContext(always) _: @Sendable (Int) async -> Void) -> Bool { false }
}