Files
swift-mirror/test/Serialization/isolated_conformance.swift
Doug Gregor 3837661b84 [Isolated conformances] Allow conformance isolation to differ from the type's
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.
2025-03-12 23:18:28 -07:00

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