Commit Graph

16 Commits

Author SHA1 Message Date
Holly Borla
6a4c7891b8 [Concurrency] Diagnose non-sendable 'self' arguments crossing isolation boundaries. 2023-08-04 09:32:41 -07:00
Becca Royal-Gordon
84592b8f8e Adopt %kind in Sendable checking diagnostic
Causes minor changes in diagnostic text.
2023-07-19 13:06:51 -07:00
Doug Gregor
7c45c7d850 [Concurrency] Check sendability of the original argument expressions in a call
When checking for the sendability in a call, use the sendability of the
original argument expressions rather than the parameter type, looking
through any implicit conversions that might remove `Sendable`.

Fixes rdar://110763694 / FB12343467.
2023-06-26 18:25:24 -07:00
Doug Gregor
d78a5edb99 Handle all isolation checking for function calls in one place
Isolation checking for calls had two separate implementation places:
one that looked at the declaration being called (for member
declarations) and one that worked on the actual call expression. Unify
on the latter implementation, which is more general and has access to
the specific call arguments. Improve diagnostics here somewher so we
don't regress in that area.

This refactoring shouldn't change the actual semantics, but it makes
upcoming semantic changes easier.
2023-06-26 13:39:56 -07:00
jturcotti
eb78da256c modify Sendable checking of overrides and protocol conformances. In the past, both the results and parameters of overriding (resp. conforming) functions were checked for Sendability. This is overly restrictive. For safety, the parameters of the overridden (resp. requiring) function should be checked for Sendability and the results of the overriding (resp. conforming) should be checked. This commit implements that change. 2023-06-16 13:39:08 -07:00
Doug Gregor
f74d6f7389 [Conformance checking] Do not inherit unavailable conformances.
When a class has an unavailable conformance to a protocol, do not
inherit that unavailable conformance, because it can get in the way of
subclasses defining their own (properly-available) conformance.

Fixes rdar://89992569.
2022-05-27 13:09:15 -07:00
Doug Gregor
c9c50b4ae0 [Requirement machine] Ignore unavailable conformances on superclass constraints.
When determining whether a superclass conforms to a particular protocol,
skip unavailable conformances. This way, we don't minimize away a
constraint that might only apply to subclasses of the specified
superclass.

Fixes rdar://91853658.
2022-05-27 13:09:15 -07:00
Doug Gregor
3faf8c3427 [SE-0338] Diagnose Sendable when leaving an actor to call nonisolated async code 2022-05-25 15:17:47 -07:00
Doug Gregor
1c55138dcf Downgrade missing @Sendable to a warning in Swift 5.x mode.
We're treating Sendable issues as warnings, not errors, so downgrade
function conversion errors to warnings as well. Fixes rdar://92291276.
2022-04-26 15:48:54 -07:00
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
Kavon Farvardin
e8e27a79d1 add coverage for <<error-type>> + Sendable diagnostic issue
when a variable with type `<<error-type>>` was captured in a
sendable function's environment, we use to emit a diagnostic
about it not being sendable, but it's for a bogus type.

at some point this issue disappeared as the sendable implementation
evolved, but this commit adds regression coverage.

resolves rdar://82452688
2022-03-03 19:08:44 -07:00
Doug Gregor
529bbec38f Align "explicitly non-Sendable" definition with proposal.
Use the explicit check for a Sendable conformance (even an unavailable
one) as the mechanism for determining whether to diagnose a
missing/unavailable Sendable conformance in a particular context.
2021-12-06 22:29:17 -08:00
Doug Gregor
be360b24f7 Perform generic substitutions for Sendable checking in protocol conformances 2021-12-03 16:41:36 -08:00
Doug Gregor
365f0afa9f Downgrade concurrency-related function type errors in existing code
When in "existing" Swift code that is Swift 5.x and has not adopted
concurrency, allow mismatches in function types that only involve
ABI-neutral concurrency changes (e.g., adding `@Sendable` or removing
a global actor) by downgrading the diagnostic to a warning. This
improves the story for incremental adoption of concurrency in an
existing code base.

As part of this, generalize the facility for downgrading an error to a
warning when performing diagnostics in the constraint solver, using the
new diagnostic behavior limits rather than duplicating diagnostics.
2021-12-02 10:33:01 -08:00
Doug Gregor
f9636af015 Align unavailable Sendable diagnostics with the proposal for staging Sendable 2021-12-01 15:00:27 -08:00