Commit Graph

22 Commits

Author SHA1 Message Date
Doug Gregor
43f6feaf19 Merge pull request #81738 from DougGregor/no-unchecked
Remove the note that suggests using `@unchecked`
2025-05-23 13:46:22 +01:00
Doug Gregor
a922e8e356 Remove the note that suggests using @unchecked
`@unchecked Sendble` is dangerous, and almost always the wrong thing to
use. Don't have the compiler suggest it.
2025-05-23 09:12:51 +01:00
Michael Gottesman
3ed4059a60 [sema] Change non-sendable -> non-Sendable in diagnostics.
This matches send non sendable but importantly also makes it clear that we are
talking about something that doesn't conform to the Sendable protocol which is
capitalized.

rdar://151802975
2025-05-22 11:37:58 -07: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
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
Holly Borla
ecd94e4908 [Concurrency] Diagnose @GlobalActor(unsafe) attributes with a fix-it to use
`@preconcurrency` instead.

This diagnosic is a warning until Swift 6, and it's ignored in swiftinterfaces.
2024-01-21 21:05:33 -08:00
Pavel Yaskevich
dbf1146963 [Concurrency] NFC: Switch tests to use -strict-concurrency=complete instead of -warn-concurrency 2023-12-08 14:10:51 -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
b53af9419c [send-non-sendable] Add REQUIRES: asserts to concurrency tests that use SendNonSendable. 2023-08-31 19:25:23 -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
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