@@ -53,9 +53,8 @@ public typealias __XCTestCompatibleSelector = Never
5353/// - Parameters:
5454/// - traits: Zero or more traits to apply to this test suite.
5555///
56- /// A test suite is a type that contains one or more test functions. Any
57- /// escapable type (that is, any type that is not marked `~Escapable`) may be a
58- /// test suite.
56+ /// A test suite is a type that contains one or more test functions. Any type
57+ /// may be a test suite.
5958///
6059/// The use of the `@Suite` attribute is optional; types are recognized as test
6160/// suites even if they do not have the `@Suite` attribute applied to them.
@@ -81,9 +80,8 @@ public macro Suite(
8180/// from the associated type's name.
8281/// - traits: Zero or more traits to apply to this test suite.
8382///
84- /// A test suite is a type that contains one or more test functions. Any
85- /// escapable type (that is, any type that is not marked `~Escapable`) may be a
86- /// test suite.
83+ /// A test suite is a type that contains one or more test functions. Any type
84+ /// may be a test suite.
8785///
8886/// The use of the `@Suite` attribute is optional; types are recognized as test
8987/// suites even if they do not have the `@Suite` attribute applied to them.
@@ -105,12 +103,12 @@ extension Test {
105103 ///
106104 /// - Warning: This function is used to implement the `@Suite` macro. Do not
107105 /// call it directly.
108- public static func __type(
109- _ containingType: any ~ Copyable . Type,
106+ public static func __type< S > (
107+ _ containingType: S . Type ,
110108 displayName: String ? = nil ,
111109 traits: [ any SuiteTrait ] ,
112110 sourceLocation: SourceLocation
113- ) -> Self {
111+ ) -> Self where S : ~ Copyable & ~ Escapable {
114112 let containingTypeInfo = TypeInfo ( describing: containingType)
115113 return Self ( displayName: displayName, traits: traits, sourceLocation: sourceLocation, containingTypeInfo: containingTypeInfo)
116114 }
@@ -166,7 +164,7 @@ extension Test {
166164 sourceLocation: SourceLocation ,
167165 parameters: [ __Parameter ] = [ ] ,
168166 testFunction: @escaping @Sendable ( ) async throws -> Void
169- ) -> Self where S: ~ Copyable {
167+ ) -> Self where S: ~ Copyable & ~ Escapable {
170168 // Don't use Optional.map here due to a miscompile/crash. Expand out to an
171169 // if expression instead. SEE: rdar://134280902
172170 let containingTypeInfo : TypeInfo ? = if let containingType {
@@ -251,7 +249,7 @@ extension Test {
251249 sourceLocation: SourceLocation ,
252250 parameters paramTuples: [ __Parameter ] ,
253251 testFunction: @escaping @Sendable ( C . Element) async throws -> Void
254- ) -> Self where S: ~ Copyable, C: Collection & Sendable , C. Element: Sendable {
252+ ) -> Self where S: ~ Copyable & ~ Escapable , C: Collection & Sendable , C. Element: Sendable {
255253 let containingTypeInfo : TypeInfo ? = if let containingType {
256254 TypeInfo ( describing: containingType)
257255 } else {
@@ -398,7 +396,7 @@ extension Test {
398396 sourceLocation: SourceLocation ,
399397 parameters paramTuples: [ __Parameter ] ,
400398 testFunction: @escaping @Sendable ( C1 . Element, C2 . Element) async throws -> Void
401- ) -> Self where S: ~ Copyable, C1 : Collection & Sendable , C1. Element: Sendable , C2: Collection & Sendable , C2. Element: Sendable {
399+ ) -> Self where S: ~ Copyable & ~ Escapable , C1 : Collection & Sendable , C1. Element: Sendable , C2: Collection & Sendable , C2. Element: Sendable {
402400 let containingTypeInfo : TypeInfo ? = if let containingType {
403401 TypeInfo ( describing: containingType)
404402 } else {
@@ -426,7 +424,7 @@ extension Test {
426424 sourceLocation: SourceLocation ,
427425 parameters paramTuples: [ __Parameter ] ,
428426 testFunction: @escaping @Sendable ( ( E1, E2) ) async throws -> Void
429- ) -> Self where S: ~ Copyable, C: Collection & Sendable , C. Element == ( E1 , E2 ) , E1: Sendable , E2: Sendable {
427+ ) -> Self where S: ~ Copyable & ~ Escapable , C: Collection & Sendable , C. Element == ( E1 , E2 ) , E1: Sendable , E2: Sendable {
430428 let containingTypeInfo : TypeInfo ? = if let containingType {
431429 TypeInfo ( describing: containingType)
432430 } else {
@@ -457,7 +455,7 @@ extension Test {
457455 sourceLocation: SourceLocation ,
458456 parameters paramTuples: [ __Parameter ] ,
459457 testFunction: @escaping @Sendable ( ( Key, Value) ) async throws -> Void
460- ) -> Self where S: ~ Copyable, Key: Sendable , Value: Sendable {
458+ ) -> Self where S: ~ Copyable & ~ Escapable , Key: Sendable , Value: Sendable {
461459 let containingTypeInfo : TypeInfo ? = if let containingType {
462460 TypeInfo ( describing: containingType)
463461 } else {
@@ -482,7 +480,7 @@ extension Test {
482480 sourceLocation: SourceLocation ,
483481 parameters paramTuples: [ __Parameter ] ,
484482 testFunction: @escaping @Sendable ( C1 . Element, C2 . Element) async throws -> Void
485- ) -> Self where S: ~ Copyable, C1 : Collection & Sendable , C1. Element: Sendable , C2: Collection & Sendable , C2. Element: Sendable {
483+ ) -> Self where S: ~ Copyable & ~ Escapable , C1 : Collection & Sendable , C1. Element: Sendable , C2: Collection & Sendable , C2. Element: Sendable {
486484 let containingTypeInfo : TypeInfo ? = if let containingType {
487485 TypeInfo ( describing: containingType)
488486 } else {
@@ -538,7 +536,8 @@ extension Test {
538536///
539537/// - Warning: This function is used to implement the `@Test` macro. Do not use
540538/// it directly.
541- @inlinable public func __requiringTry< T> ( _ value: consuming T ) throws -> T where T: ~ Copyable {
539+ @_lifetime ( copy value)
540+ @inlinable public func __requiringTry< T> ( _ value: consuming T ) throws -> T where T: ~ Copyable & ~ Escapable {
542541 value
543542}
544543
@@ -547,7 +546,8 @@ extension Test {
547546///
548547/// - Warning: This function is used to implement the `@Test` macro. Do not use
549548/// it directly.
550- @inlinable public func __requiringAwait< T> ( _ value: consuming T , isolation: isolated ( any Actor ) ? = #isolation) async -> T where T: ~ Copyable {
549+ @_lifetime ( copy value)
550+ @inlinable public func __requiringAwait< T> ( _ value: consuming T , isolation: isolated ( any Actor ) ? = #isolation) async -> T where T: ~ Copyable & ~ Escapable {
551551 value
552552}
553553
@@ -556,7 +556,8 @@ extension Test {
556556///
557557/// - Warning: This function is used to implement the `@Test` macro. Do not use
558558/// it directly.
559- @unsafe @inlinable public func __requiringUnsafe< T> ( _ value: consuming T ) -> T where T: ~ Copyable {
559+ @_lifetime ( copy value)
560+ @unsafe @inlinable public func __requiringUnsafe< T> ( _ value: consuming T ) -> T where T: ~ Copyable & ~ Escapable {
560561 value
561562}
562563
@@ -579,7 +580,7 @@ public var __defaultSynchronousIsolationContext: (any Actor)? {
579580 _ selector: __XCTestCompatibleSelector ? ,
580581 onInstanceOf type: T . Type ,
581582 sourceLocation: SourceLocation
582- ) async throws -> Bool where T: ~ Copyable {
583+ ) async throws -> Bool where T: ~ Copyable & ~ Escapable {
583584 false
584585}
585586
0 commit comments