Files
swift-mirror/test/Concurrency/sendable_module_checking.swift
Doug Gregor 4116d7a3d7 Rename the -strict-concurrency= options to be more descriptive.
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.
2022-04-20 18:17:33 -07:00

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 { }