Commit Graph

11 Commits

Author SHA1 Message Date
Anthony Latsis
14b70f306b DiagnosticVerifier: Default expected fix-it start line to the diagnostic's 2023-03-08 12:10:27 +03:00
Allan Shortlidge
c13dd18ef8 Sema: Diagnose the availability of global actor attributes. This includes SPI and resilience diagnostics. 2022-08-20 17:57:25 -07:00
Doug Gregor
0dab1b7c22 Ensure that lookup of Sendable always considers superclass Sendable.
Fixes rdar://90617628.
2022-03-25 12:53:41 -07:00
Doug Gregor
d0757349d9 Improve -require-explicit-sendable check to account for @_nonSendable
We were doing the conformance check through a lower-level interface that
didn't deal with the unavailable Sendable synthesis.
Fixes a spurious diagnostic reported via rdar://85894346.
2021-12-06 13:57:47 -08:00
Doug Gregor
7e375f7df6 Use new Sendable staging infrastructure consistently.
The main effect of this change is that diagnostics about Sendable
conformances now follow the same minimal/full logic used for other
Sendable diagnostics, rather than having their own separate
computation.
2021-11-30 18:22:53 -08:00
Becca Royal-Gordon
354f3470a0 Add @_nonSendable decl attribute
This attribute creates an unavailable extension with a `Sendable` conformance so that the type is explicity marked as not being `Sendable`.

We also fully suppress diagnostics about unavailable Sendable conformances in Swift 5 mode code. (This is not fully developed yet—it should return to being a warning in concurrent contexts.)

The behavior when a @_nonSendable and a Sendable conformance are both on the same type is also not right yet.
2021-10-14 12:14:46 -07:00
Doug Gregor
62edd18145 Ensure that we diagnose unavailable Sendable conformances in Sendable checking 2021-10-06 23:08:07 -07:00
Doug Gregor
89fd6e395e Respect @available(*, unavailable) in Sendable checking.
When a type has provided an unavailable `Sendable` conformance, don't
check its instance storage for `Sendable`. Additionally, teach
`-require-explicit-sendable` to avoid trying to add a `Sendable`
conformance when some of the instance storage relies on unavailable
`Sendable` conformances.
2021-10-06 23:02:29 -07:00
Doug Gregor
610812abe0 Suggest conditional conformance to Sendable derived from instance storage.
When proposing to annotate a public type as `Sendable` due to the
`-require-explicit-sendable` command-line parameter, suggest a
conditional conformance when it can be determined that a generic type
would be `Sendable` when certain type parameters are `Sendable`.

For example, given this type:

    public struct DictionaryHolder<T: Hashable, U, V> {
      var member: [T: (U, V?)]
    }

We will now produce a Fix-It that suggests that one add:

    extension DictionaryHolder: Sendable
      where T: Sendable, U: Sendable, V: Sendable { }
2021-10-06 22:39:51 -07:00
Doug Gregor
2e81274303 Prior to Swift 6, diagnostic unavailable Sendable conformances via warnings. 2021-10-06 13:48:51 -07:00
Doug Gregor
9db56da082 Use an unavailable extension to suppress "missing explicit Sendable" warning
Becca noticed that one can already write an unavailable `Sendable`
conformance in language:

    @available(*, unavailable)
    extension MyType: Sendable { ... }

Add tests to verify that this suppresses the "missing Sendable
annotation" warning (it does) and suggest this spelling in a Fix-It to
help users find it.
2021-10-06 13:04:29 -07:00