File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -528,6 +528,13 @@ class ApplyClassifier {
528
528
}
529
529
530
530
if (classifiedAsThrows) {
531
+ // multiple passes can occur, so ensure that any sub-expressions of this
532
+ // call are marked as throws to mimic the closure variant.
533
+ if (auto subExpr = dyn_cast<ApplyExpr>(E->getFn ())) {
534
+ if (!subExpr->isThrowsSet ()) {
535
+ subExpr->setThrows (true );
536
+ }
537
+ }
531
538
return Classification::forRethrowingOnly (
532
539
PotentialThrowReason::forRethrowsConformance (E), isAsync);
533
540
}
Original file line number Diff line number Diff line change @@ -31,4 +31,27 @@ func missingAsyncInBlock<T : AsyncSequence>(_ seq: T) {
31
31
for try await _ in seq { }
32
32
} catch { }
33
33
}
34
+ }
35
+
36
+ func doubleDiagCheckGeneric< T : AsyncSequence > ( _ seq: T ) async {
37
+ var it = seq. makeAsyncIterator ( )
38
+ // expected-note@+2{{call is to 'rethrows' function, but a conformance has a throwing witness}}
39
+ // expected-error@+1{{call can throw, but it is not marked with 'try' and the error is not handled}}
40
+ let _ = await it. next ( )
41
+ }
42
+
43
+ struct ThrowingAsyncSequence : AsyncSequence , AsyncIteratorProtocol {
44
+ typealias Element = Int
45
+ typealias AsyncIterator = Self
46
+ mutating func next( ) async throws -> Int ? {
47
+ return nil
48
+ }
49
+
50
+ func makeAsyncIterator( ) -> Self { return self }
51
+ }
52
+
53
+ func doubleDiagCheckConcrete( _ seq: ThrowingAsyncSequence ) async {
54
+ var it = seq. makeAsyncIterator ( )
55
+ // expected-error@+1{{call can throw, but it is not marked with 'try' and the error is not handled}}
56
+ let _ = await it. next ( )
34
57
}
You can’t perform that action at this time.
0 commit comments