mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Upcoming and experimental features are supported via command-line flags and also in the SwiftPM manifest. Introduce it as an experimental feature so that it can be enabled via SwiftPM without having to resort to unsafe flags. The `StrictConcurrency` experimental feature can also provide a strictness level in the same manner as `-strict-concurrency`, e.g., `StrictConcurrency=targeted`. If the level is not provided, it'll be `complete`. Note that we do not introduce this as an "upcoming" feature, because upcoming features should be in their final "Swift 6" form before becoming available. We are still tuning the checking for concurrency.
19 lines
492 B
Swift
19 lines
492 B
Swift
// RUN: %target-typecheck-verify-swift -enable-experimental-feature StrictConcurrency=targeted
|
|
// REQUIRES: concurrency
|
|
|
|
class C { // expected-note{{class 'C' does not conform to the 'Sendable' protocol}}
|
|
var counter = 0
|
|
}
|
|
|
|
func acceptsSendable<T: Sendable>(_: T) { }
|
|
|
|
func testNoConcurrency(c: C) {
|
|
acceptsSendable(c)
|
|
}
|
|
|
|
@available(SwiftStdlib 5.1, *)
|
|
func testConcurrency(c: C) async {
|
|
acceptsSendable(c) // expected-warning{{type 'C' does not conform to the 'Sendable' protocol}}
|
|
}
|
|
|