File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,19 @@ Swift Next
61
61
}
62
62
```
63
63
64
+ * [ SE-0298] [ ] :
65
+
66
+ The "for" loop can be used to traverse asynchronous sequences in asynchronous code:
67
+
68
+ ```swift
69
+ for try await line in myFile.lines() {
70
+ // Do something with each line
71
+ }
72
+ ```
73
+
74
+ Asynchronous for loops use asynchronous sequences, defined by the protocol
75
+ ` AsyncSequence ` and its corresponding ` AsyncIterator ` .
76
+
64
77
** Add new entries to the top of this section, not here!**
65
78
66
79
Swift 5.4
@@ -8309,6 +8322,7 @@ Swift 1.0
8309
8322
[SE- 0286 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0286-forward-scan-trailing-closures.md>
8310
8323
[SE- 0287 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0287-implicit-member-chains.md>
8311
8324
[SE- 0296 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0296-async-await.md>
8325
+ [SE- 0298 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0298-asyncsequence.md>
8312
8326
8313
8327
[SR- 75 ]: < https: // bugs.swift.org/browse/SR-75>
8314
8328
[SR- 106 ]: < https: // bugs.swift.org/browse/SR-106>
Original file line number Diff line number Diff line change @@ -2127,11 +2127,9 @@ ParserResult<Stmt> Parser::parseStmtForEach(LabeledStmtInfo LabelInfo) {
2127
2127
SourceLoc AwaitLoc;
2128
2128
SourceLoc TryLoc;
2129
2129
2130
- if (shouldParseExperimentalConcurrency () &&
2131
- Tok.isContextualKeyword (" await" )) {
2130
+ if (Tok.isContextualKeyword (" await" )) {
2132
2131
AwaitLoc = consumeToken ();
2133
- } else if (shouldParseExperimentalConcurrency () &&
2134
- Tok.is (tok::kw_try)) {
2132
+ } else if (Tok.is (tok::kw_try)) {
2135
2133
TryLoc = consumeToken ();
2136
2134
if (Tok.isContextualKeyword (" await" )) {
2137
2135
AwaitLoc = consumeToken ();
Original file line number Diff line number Diff line change 1
- // RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
1
+ // RUN: %target-typecheck-verify-swift
2
2
// REQUIRES: concurrency
3
+ import _Concurrency
3
4
4
5
struct AsyncRange < Bound: Comparable & Strideable > : AsyncSequence , AsyncIteratorProtocol where Bound. Stride : SignedInteger {
5
6
var range : Range < Bound > . Iterator
You can’t perform that action at this time.
0 commit comments