Skip to content

Commit 6559ed6

Browse files
authored
Merge pull request #73912 from DougGregor/async-for-each-next-isolation-availability
Fix source location info to address availability error with `next(isolation:)`.
2 parents 525e245 + 3564d14 commit 6559ed6

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/Sema/CSGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4646,7 +4646,7 @@ generateForEachStmtConstraints(ConstraintSystem &cs, DeclContext *dc,
46464646
// `next` is always async but witness might not be throwing
46474647
if (isAsync) {
46484648
nextCall =
4649-
AwaitExpr::createImplicit(ctx, /*awaitLoc=*/SourceLoc(), nextCall);
4649+
AwaitExpr::createImplicit(ctx, nextCall->getLoc(), nextCall);
46504650
}
46514651

46524652
// The iterator type must conform to IteratorProtocol.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %target-swift-frontend -target %target-cpu-apple-macos14.0 %s -emit-sil -o /dev/null -verify
2+
3+
// REQUIRES: concurrency, OS=macosx
4+
5+
func acceptClosure(_: () async throws -> Void) { }
6+
7+
@available(macOS 13.0, *)
8+
func f<S: AsyncSequence>(s: S) async throws {
9+
acceptClosure {
10+
if #available(SwiftStdlib 6.0, *) {
11+
for try await x in s {
12+
print(x)
13+
}
14+
}
15+
}
16+
}
17+
18+

0 commit comments

Comments
 (0)