Commit Graph

16 Commits

Author SHA1 Message Date
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
Pavel Yaskevich
ab4f8d0dc0 [RequirementMachine] Inherited requirements collection should account for synthesized protocols
ClangImporter adds `SynthesizedProtocolAttr` to model inheritance
from `Sendable` on protocols imported from Objective-C.
2023-11-16 10:58:34 -08:00
Doug Gregor
9bd950477c Using --enable-experimental-feature requires an asserts-enabled compiler.
Fixes rdar://97281993.
2022-07-21 09:31:32 -07:00
Doug Gregor
28a0f83590 Turn @Sendable completion handlers into an experimental feature.
`@Sendable` on completion handlers imported from Objective-C has been
implemented for a while, but has been disabled in production builds
due to a number of problems we've encountered with rolling it out.

Introduce an experimental feature for `@Sendable` completion handlers
so we can iterate on this more before we enable it by default.

Part of rdar://85569247, which will cover re-landing this feature.
2022-07-18 12:29:28 -07:00
Becca Royal-Gordon
a57e71ccd0 Import swift_attr(“@Sendable”) for result types
If `__attribute__((swift_attr(“@Sendable”)))` is applied to an ObjC method, ObjC property, C field, C variable, or C function, we will now make its result type `Sendable`.

For some entities, this technically had a different behavior previously, because `@Sendable` can be applied to `func`s to indicate that their interface type should be `@Sendable`. We don’t really want people to use this functionality on non-local functions, so we can safely remove it.

This isn’t quite interacting with `Unmanaged` the way we’d want, but I’ve included test cases for the current behavior with FIXME comments.

Fixes rdar://90491024.
2022-03-29 17:18:10 -07:00
Becca Royal-Gordon
8c844126d4 [ClangImporter] Make completion handlers Sendable
If a method has an `async` variant, the non-`async` variant will now mark its completion handler parameter `@Sendable`. This shouldn't be a breaking change in Swift 5 code since these declarations are automatically `@_predatesConcurrency`.

Also adds:

• Support for `@_nonSendable` on parameters, which can be used to override this implicit `@Sendable`
• Support for `@Sendable` on block typedefs; it's generally going to be a good idea to mark completion block typedefs `@Sendable`.

Fixes rdar://85569247.
2022-01-25 15:49:54 -08:00
Becca Royal-Gordon
ad0e7096ba Make NS_ENUM &c. Sendable even when audited
An explicit swift_attr("@_nonSendable") will override it (except for ns_error_domain where the type is embedded in another type that's forced to be Sendable), but swift_attr("@_nonSendable(_assumed)") will not.
2021-11-19 11:34:02 -08:00
Becca Royal-Gordon
8007d70659 Print Sendable conformances for clang types 2021-11-19 11:34:01 -08:00
Becca Royal-Gordon
b9480f12d0 Allow imported types to add a Sendable conformance
...by using `__attribute__((swift_attr("@Sendable")))`. `@_nonSendable` will "beat" `@Sendable`, while `@_nonSendable(_assumed)` will not.

This commit also checks if `SwiftAttr` supports `#pragma clang attribute` and, if it does, defines `__SWIFT_ATTR_SUPPORTS_SENDABLE_DECLS` in imported headers so they know they can apply these attributes in an auditing style.
2021-11-19 11:34:01 -08:00
Saleem Abdulrasool
4d44953691 Revert "Support __available__((swift_attr("@Sendable")))" 2021-11-19 07:40:24 -08:00
Becca Royal-Gordon
8751658f6c Make NS_ENUM &c. Sendable even when audited
An explicit swift_attr("@_nonSendable") will override it (except for ns_error_domain where the type is embedded in another type that's forced to be Sendable), but swift_attr("@_nonSendable(_assumed)") will not.
2021-11-12 23:13:29 -08:00
Becca Royal-Gordon
36bae62b19 Print Sendable conformances for clang types 2021-11-12 23:13:29 -08:00
Becca Royal-Gordon
7549278314 Allow imported types to add a Sendable conformance
...by using `__attribute__((swift_attr("@Sendable")))`. `@_nonSendable` will "beat" `@Sendable`, while `@_nonSendable(_assumed)` will not.

This commit also checks if `SwiftAttr` supports `#pragma clang attribute` and, if it does, defines `__SWIFT_ATTR_SUPPORTS_SENDABLE_DECLS` in imported headers so they know they can apply these attributes in an auditing style.
2021-11-12 23:13:29 -08:00
Ben Barham
e7e9b57051 Replace @completionHandlerAsync with @available(*, renamed:)
Instead of a new attribute `@completionHandlerAsync`, allow the use of
the existing `renamed` parameter of `@available` to specify the
asynchronous alternative of a synchronous function.

No errors will be output from invalid names as `@completionHandlerAsync`
had, but if a function is correctly matched then it will be used to
output warnings when using the synchronous function in an asynchronous
context (as before).

Resolves rdar://80612731
2021-07-29 09:14:44 +10:00
Doug Gregor
eeeea49764 Remove -enable-experimental-concurrency almost everywhere. 2021-07-26 21:24:43 -07:00
Hamish Knight
a2b5f68ac8 [AST] Mark @completionHandlerAsync user-inaccessible
This attribute is only really useful to the
compiler, so don't expose it to the user through
e.g generated interfaces.

Resolves rdar://76685011
2021-04-29 22:29:55 +01:00