Commit Graph

41 Commits

Author SHA1 Message Date
Doug Gregor
642214d6cb Update test 2025-06-30 20:51:18 -07:00
Doug Gregor
22efac8e12 Revert "[Concurrency] adjust abi test for hashable async stream"
This reverts commit 99d95aa21d.
2025-05-05 10:43:07 -07:00
Konrad 'ktoso' Malawski
99d95aa21d [Concurrency] adjust abi test for hashable async stream 2025-04-28 20:05:42 +09:00
Anthony Latsis
1d6ed11e46 AST: Quote attributes more consistently in DiagnosticsModuleDiffer.def 2025-04-22 18:23:40 +01:00
Doug Gregor
e24598bca1 Use a marker protocol SendableMetatype to model T.Type: Sendable
Introduce a marker protocol SendableMetatype that is used to indicate
when the metatype of a type will conform to Sendable. Specifically,
`T: SendableMetatype` implies `T.Type: Sendable`. When strict
metatype sendability is enabled, metatypes are only sendable when `T:
SendableMetatype`.

All nominal types implicitly conform to `SendableMetatype`, as do the
various builtin types, function types, etc. The `Sendable` marker
protocol now inherits from `SendableMetatype`, so that `T: Sendable`
implies `T.Type: Sendable`.

Thank you Slava for the excellent idea!
2025-02-13 22:48:05 -08:00
Doug Gregor
a47483c0ec Fix ABI issue with TaskLocal.withValue and update ABI test 2024-07-15 14:37:45 -07:00
Konrad `ktoso` Malawski
0160fc367a [Concurrency] adopt #isolation in last remaining APIs 2024-06-24 11:44:44 +09:00
Michael Gottesman
a890c6011e [sending] Do not mangle shared into function signatures if they are paired with sending.
I am doing this b/c we are going to ban borrowing sending so that we can leave
open that space for further design. In the short term, we need the ability to
create +0 sending parameters without messing with mangling. By special casing
this, we get what we want.

rdar://129116141
2024-06-01 23:25:16 -07:00
Holly Borla
c20b0e0956 [Concurrency] Obsolete AnyActor in Swift 6 using a typealias. 2024-05-29 22:59:19 -07:00
Doug Gregor
406346b4ba Merge pull request #73425 from DougGregor/task-group-next-public 2024-05-04 00:09:28 -07:00
Doug Gregor
32cf39aa11 Update API expectations for (Throwing)TaskGroup.next() 2024-05-03 13:24:20 -07:00
Holly Borla
7f5e47eb6f [NFC] Update api-digester concurrency test. 2024-04-30 16:25:17 -07:00
Konrad `ktoso` Malawski
dfcf1054dd [Concurrency] Remove _unsafeInheritExecutor from public APIs, use #isolation (#72578) 2024-04-05 03:57:54 -07:00
Konrad `ktoso` Malawski
3295ddd200 [Concurrency] waitForAll and next of TaskGroups must inherit isolation (#72794) 2024-04-04 23:49:05 -07:00
Kavon Farvardin
554fa49a1f Test: clean-up noncopyable_generics lit usage
There no longer is a lit feature called `noncopyable_generics`, it's
just always on now.
2024-04-01 12:28:08 -07:00
Kavon Farvardin
11220bb3d0 ABI Tests: include Copyable/Escapable in baseline 2024-03-14 23:10:44 -07:00
Doug Gregor
8c452b5cf5 Fix accidental ABI break with AsyncSequence.flatMap
At the type that I introduced type throws into AsyncSequence and its
algorithms, I accidentally dropped a `@preconcurrency` on the ABI
entrypoint, leading to a mangled name change.

Fixes rdar://123639030.
2024-02-26 12:38:56 -08:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Doug Gregor
b0029b24f5 Add AsyncThrowingFlatMapSequence.nextElement() 2024-01-25 16:04:45 -08:00
Doug Gregor
3e726ebc55 Add nextElement() and explicit Failure types for a number of asynchronous iterators 2024-01-25 16:04:44 -08:00
Doug Gregor
239f8d8a78 Rename AsyncIteratorProtocol._nextElement -> nextElement 2024-01-25 16:04:43 -08:00
Doug Gregor
b2a5ebe1bd Always emit AsyncIteratorProtocol._nextElement into the client
... this allows us to use the entrypoint when back-deploying code that
uses the async for..in loop.
2024-01-25 16:04:43 -08:00
Doug Gregor
bb7a563e6c Switch async for-each loop over to _nextElement and drop @rethrows.
This couples together several changes to move entirely from
`@rethrows` over to typed throws:

* Use the `Failure` type to determine whether an async for-each loop
will throw, rather than depending on rethrows checking

* Introduce a special carve-out for `rethrows` functions that have a
generic requirement on an `AsyncSequence` or `AsyncIteratorProtocol`,
which uses that requirement's `Failure` type as potentially being part
of the thrown error type. This allows existing generic functions like
the following to continue to work:

    func f<S: AsyncSequence>(_: S) rethrows

* Switch SIL generation for the async for-each loop from the prior
`next()` over to the typed-throws version `_nextElement`.

* Remove `@rethrows` from `AsyncSequence` and `AsyncIteratorProtocol`
entirely. We are now fully dependent on typed throws.
2024-01-25 16:04:43 -08:00
Doug Gregor
a5bdb12b48 Adopt typed throws in AsyncIteratorProtocol and AsyncSequence
Introduce a new associated type `Failure` into the two protocols involved
in async sequences, which represents the type thrown when the sequence
fails. Introduce a defaulted `_nextElement()` operations that throws
`Failure` or produces the next element of the sequence. Provide a
default implementation of `_nextElement()` in terms of `next()` that
force-cases the thrown error to the `Failure` type.

Introduce special associated type inference logic for the `Failure`
type of an `AsyncIteratorProtocol` conformance when there is no
specific _nextElement()` witness. This inference logic looks at the
witness for `next()`:
* If `next()` throws nothing, `Failure` is inferred to `Never`.
* If `next()` throws, `Failure` is inferred to `any Error`.
* If `next()` rethrows, `Failure` is inferred to `T.Failure`, where
`T` is the first type parameter with a conformance to either
`AsyncSequence` or `AsyncIteratorProtocol`.

The default implementation and the inference rule, together, allow
existing async sequences to continue working as before, and set us up
for changing the contract of the `async for` loop to use
`_nextIterator()` rather than `next()`.

Give `AsyncSequence` and `AsyncIteratorProtocol` primary associated
types for the element and failure types, which will allow them to be
used more generally with existential and opaque types.
2024-01-25 16:04:42 -08:00
Allan Shortlidge
860b8cdf48 Concurrency: Revert workarounds for @backDeployed condfails.
All compilers that must be able to compile the standard library's textual
interface accept the following:
- back deployed functions declared without `@available`
- `@inlinable` back deployed functions
- `defer` blocks in back deployed functions

We can therefore revert the workarounds added in
https://github.com/apple/swift/pull/62946/ and
https://github.com/apple/swift/pull/62928/.

Resolves rdar://104085810
2023-05-08 18:21:08 -07:00
Konrad `ktoso` Malawski
e0877594da [Concurrency] Custom executors with move-only Job (#63569) 2023-03-18 14:02:43 +09:00
Xi Ge
9a98766df2 ABIChecker: consider adding @_predatesConcurrency ABI-safe
We shouldn't diagnose adding @_predatesConcurrency without considering the context because the attribute itself is for ABI-preserving purposes.

rdar://90738915
2023-03-14 17:26:01 -07:00
Konrad `ktoso` Malawski
fffe782fac Enable Concurrency ABI verifier test on apple silicon (#63987) 2023-03-02 11:26:51 +09:00
Anthony Latsis
5c0620bd08 Gardening: Migrate test suite to GH issues: api-digester 2022-08-11 17:43:23 +03:00
Yuta Saito
30b9fc90a8 Concurrency: fix inconsistent _asyncLet_get signatures 2022-03-30 20:58:40 +09:00
Evan Wilde
4700bc7e70 Add _runAsyncMain to api digester list
Adding `_runAsyncMain` to the api-digester list since we're adding
`@preconcurrency` when we add `@Sendable`. These two should negate each
other, but the api-digester isn't quite smart enough to understand that.
2022-03-21 13:02:20 -07:00
Konrad `ktoso` Malawski
369f3e62d9 [Concurrency] ignore @_marker protocol AnyActor ABI warnings
These are not an issue because adding a @_marker protocol conformance has no ABI impact - the protocol is not available at runtime.
2022-03-08 20:00:27 +09:00
Philippe Hausler
b0f0cb257d Audit and correct AsyncSequence Sendability (#41253)
* Audit and correct AsyncSequence Sendability

* Annotate availability on Sendable conformances for AsyncSequences

* Fix typo of Sendable.Iterator

* Correct tests to use sendable builders

* Add @preconcurrency annotations and fixup one remaining missing @Sendable case

* Move preconcurrency to correct syntactical position

* Use unchecked Sendable conditional conformance instead of marking all internals as preconcurrency and sendable

* Use unchecked Sendable conditional conformance instead of marking all internals as preconcurrency and sendable for dropWhile

* claim ABI changes for marking of @preconcurrency as expected
2022-03-04 21:21:32 -08:00
Doug Gregor
353daabf8d Replace UnsafeSendable with @unchecked Sendable in the standard library. 2021-11-12 07:56:10 -08:00
Artem Chikin
2ba1dc8b4e Update stability-concurrency-abi.test expected output 2021-10-25 13:17:41 -07:00
Doug Gregor
2850b65bd9 Simplify implementation and fix a test 2021-10-22 08:30:50 -07:00
Doug Gregor
5f9721c7fb Ensure that we hop off the main actor after MainActor.run.
Asynchronous functions isolated to global actors hop to the global at
the beginning of the function but do not hop back on return. For
`MainActor.run`, this means that we would not "hop back" off the main
actor after executing the closure, which lead to too much code running
on the main thread. Dropping the "async" ensures that we hop back.
While we my also want the general "hop back" semantics for
asynchronous actor-isolated functions, for now this addresses the
problem with `MainActor.run`.

Fixes rdar://82138050.
2021-10-21 23:26:02 -07:00
Xi Ge
daab430ea3 test: rebaseline stable ABI for _Concurrency 2021-10-21 13:06:11 -07:00
Xi Ge
819e53e94f ABI checker: removing deprecated APIs should be considered acceptable 2021-10-20 13:16:52 -07:00
Doug Gregor
11fc58287c Update _Concurrency library ABI diff to account for @frozen reversion. 2021-10-12 11:38:15 -07:00
Doug Gregor
4961220a2d Add ABI baseline and checking for _Concurrency library on macOS
Add the generated ABI baseline for the _Concurency model on x86_64
macOS, along with a test that checks the built _Concurrency model
against that baseline.

Right now, the test is a mess, because we have some ABI breaks to
unwind. Add it so the test passes, and then we'll audit and address
every change.

Fixes rdar://83673282.
2021-10-08 21:18:30 -07:00