mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The three options are now: * `explicit`: Enforce Sendable constraints where it has been explicitly adopted and perform actor-isolation checking wherever code has adopted concurrency. (This is the default) * `targeted`: Enforce Sendable constraints and perform actor-isolation checking wherever code has adopted concurrency, including code that has explicitly adopted Sendable. * `complete`: Enforce Sendable constraints and actor-isolation checking throughout the entire module.
22 lines
999 B
Swift
22 lines
999 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -warn-concurrency %S/Inputs/StrictModule.swift
|
|
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/NonStrictModule.swiftmodule -module-name NonStrictModule %S/Inputs/NonStrictModule.swift
|
|
// RUN: %target-swift-frontend -typecheck -strict-concurrency=targeted -disable-availability-checking -I %t 2>&1 %s | %FileCheck %s
|
|
|
|
// REQUIRES: concurrency
|
|
|
|
import StrictModule
|
|
import NonStrictModule
|
|
|
|
actor A {
|
|
func f() -> [StrictStruct: NonStrictClass] { [:] }
|
|
}
|
|
|
|
func testA(a: A) async {
|
|
_ = await a.f() // CHECK: warning: cannot call function returning non-sendable type '[StrictStruct : NonStrictClass]' across actors}}
|
|
// CHECK: note: struct 'StrictStruct' does not conform to the 'Sendable' protocol
|
|
// CHECK: note: class 'NonStrictClass' does not conform to the 'Sendable' protocol
|
|
}
|
|
|
|
extension NonStrictStruct: @unchecked Sendable { }
|