Commit Graph

24 Commits

Author SHA1 Message Date
Pavel Yaskevich
f474588f4d [TypeChecker] Make sure that @preconcurrency use is detected in assignments
If destination is marked as `@preconcurrency` the Sendable conformance
errors should be downgraded to warnings even in Swift 6 mode just like
for member and subscript references.
2025-02-14 10:28:46 -08:00
Pavel Yaskevich
aa0b356147 [TypeChecker] Make sure that @preconcurrency use is detected in base expressions
This expands https://github.com/swiftlang/swift/pull/77510 to base
expressions of calls, subscripts and members to make sure that if
the base has `@preconcurrency` declaration at some level. Otherwise,
the availability checker won't appropriately downgrade unavailable
`Sendable` conformances for `@preconcurrency` declarations.
2025-02-13 18:04:19 -08:00
Holly Borla
f6cd19a01a [Concurrency] Handle self apply exprs when computing @preconcurency in the
availability checker.
2024-11-09 10:14:29 -08:00
Holly Borla
7331c5e543 [Concurrency] Downgrade preconcurrency errors about unavailable conformances
to `Sendable`.
2024-11-08 17:44:22 -08:00
Holly Borla
806de5a90a [Concurrency] Downgrade Sendable requirement failures in existential
erasure expressions for arguments to `@preconcurrency` functions in Swift
6 mode.
2024-11-08 10:01:13 -08:00
Holly Borla
e21bf2ffb4 [Concurrency] Downgrade @preconcurrency conformance requirement failures to
warnings in Swift 6 mode.
2024-11-07 17:32:30 -08:00
Holly Borla
a31a9d3642 [Concurrency] Downgrade @preconcurrency @Sendable conversion failures
to warnings even in Swift 6.
2024-11-07 16:02:37 -08: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
Pavel Yaskevich
22b9dd7f7b [Concurrency] Allow global actor mismatches while overriding @preconcurrency members in Swift 5 mode
Downgrade a mismatch on global actor attributes to a warning until
Swift 6 to enable class authors to introduce concurrency annotations
to overridable members.

Resolves: rdar://131347583
2024-09-13 11:28:47 -07:00
Pavel Yaskevich
cdf28bc482 [Concurrency] Allow sendability mismatches while overriding @preconcurrency properties in Swift 5 mode
Downgrade a mismatch on `any Sendable` -> `Any` to a warning until
Swift 6 to enable class authors to introduce concurrency annotations
to overridable properties.

Resolves: rdar://122193606
2024-07-08 09:29:50 -07:00
Holly Borla
1406b28de0 [Concurrency] Consider the upcoming feature flags in the originating module when
applying `@Sendable` inference for global-actor-isolated function types.

Otherwise, for libraries that do not enable `GlobalActorIsolatedTypesUsability`,
clients that do will encounter mangling mismatches for any library APIs that
have global-actor-isolated function types that are not explicitly `@Sendable`.
2024-06-17 18:01:45 -07:00
Michael Gottesman
de85b79423 [concurrency] Make GlobalActorIsolatedTypesUsability an upcoming swift 6 feature.
rdar://118244451
2024-05-13 18:40:58 -07:00
Michael Gottesman
b3e837c16c [region-isolation] Enable region isolation by default with strict-concurrency.
I added a disable flag -disable-region-based-isolation-with-strict-concurrency
so that we do not need to update the current tests. It is only available when
asserts are enabled to ensure users cannot use it.

rdar://125918028
2024-04-04 13:07:32 -07:00
Michael Gottesman
99e3f7fb13 [region-isolation] Make RegionBasedIsolation an upcoming feature for swift 6.
To make the tests pass, I had to teach sil-opt how to setup upcoming features
since it did not know how to parse them.

rdar://124100266
2024-03-05 15:15:14 -08:00
Pavel Yaskevich
7c0bb41573 [ConstraintSystem] Skip sendability check for static members
Such members only capture base metatatypes which are themselves
always sendable.
2024-02-26 11:52:38 -08:00
Holly Borla
f1cd9cb422 [Test] Remove REQUIRES: asserts from tests that use -swift-version 6. 2024-02-13 07:13:35 -08:00
Pavel Yaskevich
c7c7df3329 [Frontend] NFC: Promote InferSendableFromCaptures to an upcoming feature in Swift 6 2024-02-01 10:56:22 -08:00
Holly Borla
0e71623386 [SE-0411] Promote IsolatedDefaultValues from an experimental feature to an
upcoming feature.
2024-01-10 14:54:24 -08:00
Michael Gottesman
cb46851194 [region-isolation] Rename the experimental feature to RegionBasedIsolation.
This ensures that the pass is called TransferNonSendable but the experimental
feature is RegionBasedIsolation.
2023-10-26 12:01:44 -07:00
Michael Gottesman
0bad8f9b67 [region-isolation] Rename SendNonSendable.cpp -> TransferNonSendable.cpp. 2023-10-26 12:01:44 -07:00
Michael Gottesman
026f1735b5 [send-non-sendable] Update concurrency tests so that we run them in all concurrency modes as appropriate.
This means that:

1. In test cases where minimal is the default (swift 5 without
-warn-concurrency), I added RUN lines for targeted, complete, and complete +
sns.

2. In test cases where complete is the default (swift 6, -warn-concurrency,
specified complete with -strict-concurrency), I added a send non-sendable run
line.

In each of these cases, I added additional expected-* lines as appropriate so
the tests can compile in each mode successfully.
2023-08-30 13:40:17 -07:00
Doug Gregor
7149702d12 Rename @_predatesConcurrency to @preconcurrency.
Introduce the `@preconcurrency` attribute name for `@_predatesConcurrency`,
which has been the favored name in the pitch thread so far. Retain the
old name for now to help smooth migration.
2022-01-26 08:39:01 -08:00
Erik Eckstein
65bdb8054c tests: the Concurrency/predates_concurrency_swift6.swift requires asserts 2021-12-04 21:24:29 +01:00
Doug Gregor
30c5cf2ab3 In Swift 6, every context requires strict concurrency checking
This ensures, among other things, that `@_predatesConcurrency` doesn't
affect the types of entities anywhere in a module compiled in Swift 6, so
we get stricter checking throughout.
2021-12-02 11:44:10 -08:00