Commit Graph

9 Commits

Author SHA1 Message Date
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
Slava Pestov
afa5a8874c AST: Add AnyFunctionType::hasEffect() 2021-02-28 22:21:08 -05:00
Slava Pestov
09dedaa5fe Sema: Start abstracting out the 'effect' in rethrows-checking logic
For now, this is NFC, but it lays the groundwork for implementing
'reasync'.
2021-02-17 18:34:18 -05:00
swift-ci
06513524e9 Merge pull request #35940 from AnthonyLatsis/eof-warn 2021-02-12 11:37:40 -08:00
Anthony Latsis
39649161d0 Gardening: See to some missing newline warnings 2021-02-12 17:00:47 +03:00
Slava Pestov
e2d4eb64e0 Sema: Fix recursion into associated conformances when checking for rethrows
The logic for recursively expanding protocol requirements was broken.
Instead, let's do the recursive visitation when evaluating a
conformance to a @rethrows protocol.
2021-02-10 16:30:30 -05:00
Slava Pestov
f3c9b00298 AST: Allow empty protocols to be @rethrows 2021-02-09 00:11:01 -05:00
Slava Pestov
a1d483faf3 AST: Move some code from ProtocolConformance.cpp to Effects.cpp / TypeCheckEffects.cpp 2021-02-09 00:11:01 -05:00
Slava Pestov
547057380f AST: Split off Effects.cpp from Decl.cpp 2021-02-09 00:11:01 -05:00