Commit Graph

17 Commits

Author SHA1 Message Date
Pavel Yaskevich
574537fc8a [Concurrency] Global actor isolated conformances are only allowed to override nonisolated.
Follow-up for https://github.com/swiftlang/swift/pull/79893.

More than one global actor isolated conformance at any level
creates a clash and conforming type should be inferred as `nonisolated`.

Resolves: rdar://154202375
(cherry picked from commit 2e1fe444a6)
2025-06-24 17:23:03 -07:00
Pavel Yaskevich
06d1224aec [Concurrency] SE-0449: nonisolated on a type should prevent isolation inference from protocol requirements
If a `nonisolated` type conforms to a global-isolated protocol
the witnesses to the protocol requirements should infer the
isolation from the protocol but instead be `nonisolated`.

Resolves: rdar://145519840
(cherry picked from commit e50acbf3d5)
2025-06-17 15:29:18 -07:00
Pavel Yaskevich
7d0e2b51fd [Concurrency] SE-0449: Implied conformances to nonisolated protocols make witnesses nonisolated
Even if the requirement is stated on an isolated protocol if the
conformance is implied by a nonisolated one all of the requirements
and witnesses should be nonisolated.

(cherry picked from commit 06be7bda39)
2025-06-17 15:29:18 -07:00
Pavel Yaskevich
6e245641a2 [Tests] NFC: Add a test-case for main-actor isolated struct and nonisolated protocol
(cherry picked from commit 82497af27d)
2025-06-17 15:29:18 -07:00
Sima Nerush
a0b0a0704d [Concurrency] Make sure to still infer global actor if the conformance kind is explicit.
(cherry picked from commit 7e42a19187)
2025-06-17 15:29:18 -07:00
Sima Nerush
0ed6c1cf41 [Concurrency] Look for explicit 'nonisolated' when getting isolation from protocol conformances.
(cherry picked from commit 4fca62a771)
2025-06-17 15:29:18 -07:00
Anthony Latsis
72c0d4cc75 Diag: Handle CustomAttr in formatDiagnosticArgument 2025-03-28 02:03:38 +00:00
Hamish Knight
42e554ef7d [Parse] Set AttrRange for @nonisolated
Make sure we set the `AttrRange` in cases where `@` is present, but
`unsafe` isn't present.

rdar://147965036
2025-03-27 18:48:55 +00:00
Holly Borla
796dc9218b [Concurrency] Never treat nonisolated(unsafe) properties as actor
isolated.
2025-03-26 19:31:01 -07:00
Michael Gottesman
527616d105 [sema] Move some extra type checking from getIsolationFromAttribute to the attribute checker.
This never belonged in ActorIsolationRequest since it fits perfectly in the
attribute checker. This also simplifies the logic before I add code to
getIsolationFromAttribute to handle ExecutionAttribute.
2025-01-28 12:39:05 -08:00
Daniel Rodríguez Troitiño
5abb1ea6ac [test] Remove some REQUIRES: for features not longer used in those files
While doing #76740 I iteratively was adding new `REQUIRES:` as new
usages of the features were found, but I did not realize that at the
same time other people might be removing some of those usages. The tests
in this commit had some `REQUIRES:` line for a previous
`-enable-experimental/upcoming-feature`, but they not longer use those
features, so the `REQUIRES:` were effectively disabling the tests (at
least in the case of `KeyPathWithStaticMembers`. In other cases they
might still had executed).
2024-11-04 20:53:07 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Sima Nerush
549262a57d [SE-0449] Promote GlobalActorInferenceCutoff to upcoming feature. 2024-10-22 15:25:58 -07:00
Allan Shortlidge
c02fc4724d Tests: Remove -disable-availability-checking from many Concurrency tests.
Instead, use the `%target-swift-5.1-abi-triple` substitution to compile the tests
for deployment to the minimum OS versions required for use of _Concurrency APIs.
2024-10-18 16:21:51 -07:00
Sima Nerush
7e5a57a07a Guard the changes behind an experimental feature flag. 2024-09-19 10:09:56 -07:00
Sima Nerush
6ff022d132 [Concurrency] Allow nonisolated on stored properties of non-'Sendable' type. 2024-09-19 10:09:11 -07:00
Sima Nerush
40185cce2a [Concurrency] Allow nonisolated to be used on protocols, extensions, classes, structs, and enums. 2024-09-19 10:09:11 -07:00