Commit Graph

5 Commits

Author SHA1 Message Date
Holly Borla
0d5e59882a [Concurrency] Implement a narrow carve out in the isolation
override checking for `NSObject.init()`

Overriding `NSObject.init()` within a `@MainActor`-isolated type
is difficult-to-impossible, especially if you need to call an initializer
from an intermediate superclass that is also `@MainActor`-isolated.
This won't admit a runtime data-race safety hole, because dynamic
isolation checks will be inserted in the @objc thunks under
`DynamicActorIsolation`, and direct calls will enforce `@MainActor`
as usual.
2024-08-06 23:08:35 -07:00
Pavel Yaskevich
f7d3230535 [Concurrency] Fix disallowed override isolation to carry @preconcurrency bit
If ObjC member cannot be overridden due to isolation mismatch set `@preconcurrency`
bit to make the diagnostic a warning instead of an error in Swift 5 mode.

Resolves: rdar://130776220
2024-07-09 13:34:17 -07:00
Michael Gottesman
474aa47732 [concurrency] Standardize sending of non-isolated -> nonisolated to match the keyword 'nonisolated'.
rdar://130827967
2024-06-29 18:09:38 -07:00
Holly Borla
128a8bc942 [Concurrency] Don't ignore mismatching isolation for overrides of
Clang-imported superclass methods.
2024-06-08 16:58:30 -07:00
Holly Borla
57214ce7fb [Concurrency] Try harder to downgrade preconcurrency errors to warnings in
Swift 5 mode.

When you annotate a ValueDecl with `@preconcurrency`, the compiler should allow
concurrency violations by downgrading errors in the actor isolation checker to
warnings in Swift 5 mode. Previously, the actor isolation checker only checked
whether the caller's context was preconcurrency when deciding to downgrade, so
referencing preconcurrency declarations directly remained errors. Preconcurrency
was also dropped when computing actor isolation for declarations imported from
clang, which are always preconcurrency.
2023-10-04 07:07:41 -07:00