mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
With the move to explicitly specifying the global actor for an isolated conformance, we can now have conformances whose isolation differs from that of the type, including having actors with global-actor-isolated conformances. Introduce this generalization to match the proposal, and update/add tests accordingly.
17 lines
764 B
Swift
17 lines
764 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -emit-module -target %target-swift-5.1-abi-triple -swift-version 6 -enable-experimental-feature IsolatedConformances -o %t/def_isolated_conformance.swiftmodule %S/Inputs/def_isolated_conformance.swift
|
|
|
|
// RUN: %target-swift-frontend -typecheck -verify -target %target-swift-5.1-abi-triple -swift-version 6 -enable-experimental-feature IsolatedConformances %s -I %t
|
|
|
|
// REQUIRES: swift_feature_IsolatedConformances
|
|
// REQUIRES: concurrency
|
|
|
|
import def_isolated_conformance
|
|
|
|
func acceptMyProtocol(_: some MyProtocol) { }
|
|
|
|
nonisolated func f(mc: MyClass) {
|
|
acceptMyProtocol(mc)
|
|
// expected-error@-1{{main actor-isolated conformance of 'MyClass' to 'MyProtocol' cannot be used in nonisolated context}}
|
|
}
|