mirror of
https://github.com/apple/swift.git
synced 2026-11-20 05:27:31 +01:00
Leans on the previous refactor to apply file-level default isolation via isolation inference. Follows the 'final' version of 478, so top level globals are included in file-level default isolation. Adds `effectivelyExplicit` method, to be used instead of checking for the Explicit enum value directly, since a file-level default isolation should be treated as effectively default for free un/adopt (the non-explicit form would be unintuitive to express without the module feature flag). This commit will diagnose @available or @diagnose until the next commit... Note that computeActorIsolation needs to be updated to accept isolation on file-scope global stored properties, the old check was too broad, and in (i think?) trying to reject isolation on computed properties of types, also rejected it on top-level code.
21 lines
782 B
Swift
21 lines
782 B
Swift
// RUN: %target-swift-frontend -enable-experimental-feature DefaultIsolationPerFile -typecheck -swift-version 6 -parse-as-library -verify %s
|
|
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: swift_feature_DefaultIsolationPerFile
|
|
|
|
using nonisolated
|
|
|
|
// implicitly Sendable
|
|
@MainActor class Base {}
|
|
|
|
final class FinalSub: Base {}
|
|
|
|
// TODO: diagnostic would ideally provide more information in these cases...
|
|
|
|
// implicitly nonisolated
|
|
class Sub: Base {} // expected-error {{non-final class 'Sub' cannot conform to the 'Sendable' protocol}}
|
|
|
|
// implicitly nonisolated
|
|
// nonisolated subclass can't inherit Sendable from @MainActor even with @unchecked
|
|
class UncheckedSub: Base, @unchecked Sendable {} // expected-error {{non-final class 'UncheckedSub' cannot conform to the 'Sendable' protocol}}
|