Commit Graph

6 Commits

Author SHA1 Message Date
Doug Gregor
4116d7a3d7 Rename the -strict-concurrency= options to be more descriptive.
The three options are now:

* `explicit`: Enforce Sendable constraints where it has been explicitly adopted and perform actor-isolation checking wherever code has adopted concurrency. (This is the default)
* `targeted`: Enforce Sendable constraints and perform actor-isolation checking wherever code has adopted concurrency, including code that has explicitly adopted Sendable.
* `complete`: Enforce Sendable constraints and actor-isolation checking throughout the entire module.
2022-04-20 18:17:33 -07:00
Doug Gregor
f404b58b96 Add -strict-concurrency=limited to tests that specifically need it.
This isolates us from changes in the default.
2022-04-20 09:11:10 -07:00
Doug Gregor
dd6a061b29 Only consider a module "strict" if it was compiled in Swift 6 2022-04-19 21:48:35 -07:00
Becca Royal-Gordon
ecdd42f20c Make @preconcurrency import hide sendable variance
When the conformance checker and override checker detect a difference in a function type’s @Sendable attribute that varies in an illegal way, they now check if the protocol/base class was imported with an @preconcurrency import, and either limit the diagnostic or suggest adding @preconcurrency to the import as appropriate.

Completes rdar://91109455.
2022-04-08 13:08:39 -07:00
Becca Royal-Gordon
9cbac44031 Don’t recommend @preconcurrency on audited imports
If a type is explicitly non-Sendable, we don’t want to recommend softening errors with `@preconcurrency import` (even thought that would still work), because these probably represent *real* errors that you ought to fix. And at the extreme end of this, if a module is built with `-warn-concurrency` or `-swift-version 6`, *all* of its types should be treated as though they have explicit sendability, since we assume the entire module has been audited.

(Eventually, we plan to do this at module build time by actually serializing out unavailable conformances rather than by looking at the settings used to build the module, but we aren’t there quite yet.)

Implement this and test it by checking that the preconcurrency sendable tests never recommend adding `@preconcurrency` to an import of `StrictModule`, even when we do the same illegal things with it that cause that remark to be printed for `NonStrictModule`.
2022-04-07 22:29:37 -07:00
Doug Gregor
363f203277 Make @preconcurrency suppress Sendable diagnostics more reliably.
Sendable diagnostics were firing a bit too eagerly because a suppressed
Sendable diagnostic for instance storage of a struct/enum would still
cause that type to not be implicitly Sendable. Additionally, a
`@preconcurrency` import would not always suppress the diagnostic when
there was an explicit Sendable conformance, which it should have.

Fixes rdar://88363542.
2022-02-01 21:31:03 -08:00