Commit Graph

26 Commits

Author SHA1 Message Date
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
Sophia Poirier
b132671d84 [Concurrency] add comment about bug causing Sendable conformance test case to be error rather than warning (follow up to e8d98047d) 2024-10-31 11:55:28 -07:00
Sophia Poirier
84eaee474c [Concurrency] fix erroneous "@preconcurrency import" diagnostic when protocol sendability conformance diagnostic has been suppressed under minimal concurrency checking (resolves #74904) 2024-10-16 16:18:21 -07:00
Pavel Yaskevich
f8f7db3e5c [Concurrency] Allow properties with @Sendable function types witness non-Sendable requirements
This is already supported for method and subscript witnesses that get
their types decomposed.

```
protocol P {
  var test: () -> Void { get }
}

extension S : P {
  let test: @Sendable () -> Void // no concurrency warnings
}
```

Resolves: rdar://133403333
2024-09-25 13:17:19 -07:00
Holly Borla
976d92143c [Concurrency] Split up the non-Sendable property diagnostics and improve
wording.
2024-08-05 14:56:45 -07:00
Holly Borla
bd1653e497 [Concurrency] Split up the non-Sendable result diagnostics and improve
wording.
2024-08-05 09:56:11 -07:00
Holly Borla
85b66d1dc2 [ConformanceLookup] Always prefer unavailable Sendable conformances from the
defining module, and diagnose redundant Sendable conformances.

We still allow re-stating inherited unchecked Sendable conformances in
subclasses because inherited Sendable conformances are surprising when
they opt out of static checking. Otherwise, warning on redundant Sendable
conformances nudges programmers toward cleaning up unnecessary retroactive
Sendable conformances over time as libraries incrementally add the
conformances directly.
2024-07-11 20:33:24 -07:00
Holly Borla
537d7a5a5a [Concurrency] Classes nested in actors are not semantically final.
The check for actor methods in `isSemanticallyFinal` was accidentally
kicking in for class members, which avoided `Sendable` checking on
classes nested in actors.
2024-04-05 08:37:25 -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
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
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
717da76ec2 [SE-0338] Perform Sendable checking when exiting an actor via conformance.
When a requirement is actor-isolated and asynchronous but its witness is
non-isolated, perform Sendable checking on the requirement's type.
2022-05-25 15:17:47 -07:00
Doug Gregor
a8e16297a9 Sendable checking for overrides.
When an override means crossing an actor boundary, check Sendability of
parameters and results.
2022-05-25 15:17:47 -07:00
Slava Pestov
9170378d25 RequirementMachine: Fix handling of Sendable conformances for superclass requirements
Don't set allowMissing to true when checking conformance of a superclass requirement
to a protocol, since this prevents us from being able to express something like
'T : C, T : Sendable' to mean 'T can be any subclass of C which is also Sendable'.

Fixes rdar://problem/91530343.
2022-04-11 14:52:32 -04:00
Doug Gregor
f3fd64a71b Support missing Sendable conformances everywhere in the requirement machine 2022-04-08 16:10:38 -07:00
Doug Gregor
45c7d6f4b8 Allow missing Sendable conformances when type parametesr are made concrete.
Fixes rdar://91174106.
2022-04-08 15:42:33 -07:00
Becca Royal-Gordon
79a7f39631 Permit redeclaration of superclass's Sendable-ness
A recent change to `Sendable` conformance handling resulted in subclasses of global-actor-confined classes being rejected if they explicitly declared a conformance to `Sendable`.

This behavior is technically correct because actor-isolated types are implicitly `Sendable`, but the source compatibility regression was not desirable. We are also considering requiring subclasses to explicitly repeat their superclass's `Sendable` conformance, so it makes sense to allow these redundant conformances in the general case to ease that potential transition.

Fixes rdar://88700507.
2022-02-09 16:02:27 -08:00
Doug Gregor
cd5145921e Ensure that we warn about non-local non-@unchecked Sendable conformances. 2022-01-30 23:55:39 -08:00
Doug Gregor
5023a934fc Tolerate missing Sendable conformances on superclasses.
Fixes the crash in rdar://86653457
2022-01-11 11:11:21 -08:00
Doug Gregor
88e32e42cb Improve sendable diagnostics for property accesses 2021-12-16 16:50:11 -08:00
Doug Gregor
11601c477d Improve Sendable diagnostics for result types of functions. 2021-12-16 15:43:25 -08:00
Doug Gregor
bcfd27edd9 Sendable checking for an an isolated witnesses to a nonisolated requirement
When a non-isolated requirement is witnessed by an actor-isolated
witness, we are crossing into the actor. Ensure that we perform
Sendable checking across the actor boundary here.

Fixes the rest of rdar://80424675.
2021-12-14 16:56:15 -08:00