mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Instead, use the `%target-swift-5.1-abi-triple` substitution to compile the tests for deployment to the minimum OS versions required for use of _Concurrency APIs.
38 lines
988 B
Swift
38 lines
988 B
Swift
// RUN: %target-typecheck-verify-swift -strict-concurrency=complete -target %target-swift-5.1-abi-triple
|
|
|
|
@MainActor
|
|
class C {
|
|
let x: Int = 0
|
|
|
|
deinit {
|
|
// expected-warning@+1 {{capture of 'self' in a closure that outlives deinit; this is an error in the Swift 6 language mode}}
|
|
Task { @MainActor in
|
|
_ = self
|
|
}
|
|
|
|
// expected-warning@+1 {{capture of 'self' in a closure that outlives deinit; this is an error in the Swift 6 language mode}}
|
|
Task {
|
|
_ = x
|
|
}
|
|
}
|
|
}
|
|
|
|
func enqueueSomewhereElse(_ closure: @escaping @Sendable () -> Void) {}
|
|
|
|
@MainActor
|
|
class C2 {
|
|
let x: Int = 0
|
|
|
|
deinit {
|
|
// expected-warning@+1 {{capture of 'self' in a closure that outlives deinit; this is an error in the Swift 6 language mode}}
|
|
enqueueSomewhereElse {
|
|
_ = self
|
|
}
|
|
|
|
// expected-warning@+1 {{capture of 'self' in a closure that outlives deinit; this is an error in the Swift 6 language mode}}
|
|
enqueueSomewhereElse {
|
|
_ = self.x
|
|
}
|
|
}
|
|
}
|