You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncletresult:Int= seq.reduce(0){ $0 + $1 } // expected-error{{call can throw, but it is executed in a non-throwing autoclosure}} expected-note{{call is to 'rethrows' function, but a conformance has a throwing witness}}
5
+
asyncletresult:Int= seq.reduce(0){ $0 + $1 } // OK
8
6
// expected-warning@-1{{immutable value 'result' was never used; consider replacing with '_' or removing it}}
asynclet _:Int= seq.reduce(0){ $0 + $1 } // expected-error{{call can throw, but it is executed in a non-throwing autoclosure}} expected-note{{call is to 'rethrows' function, but a conformance has a throwing witness}}
asyncletresult= seq.reduce(0){ $0 + $1 } // expected-error{{call can throw, but it is executed in a non-throwing autoclosure}} expected-note{{call is to 'rethrows' function, but a conformance has a throwing witness}}
14
+
asyncletresult= seq.reduce(0){ $0 + $1 } // OK
17
15
// expected-warning@-1{{initialization of immutable value 'result' was never used; consider replacing with assignment to '_' or removing it}}
asynclet _ = seq.reduce(0){ $0 + $1 } // expected-error{{call can throw, but it is executed in a non-throwing autoclosure}} expected-note{{call is to 'rethrows' function, but a conformance has a throwing witness}}
19
+
asynclet _ = seq.reduce(0){ $0 + $1 } // OK
22
20
}
23
21
24
22
func testAsyncSequenceTypedPattern<Seq:AsyncSequence>(_ seq:Seq)asyncthrowswhere Seq.Element ==Int{ // expected-note{{consider making generic parameter 'Seq' conform to the 'Sendable' protocol}} {{54-54=, Sendable}}
25
-
asyncletresult:Int= seq.reduce(0){ $0 + $1 } // expected-error{{call can throw, but it is executed in a non-throwing autoclosure}} expected-note{{call is to 'rethrows' function, but a conformance has a throwing witness}}
23
+
asyncletresult:Int= seq.reduce(0){ $0 + $1 } // OK
26
24
// expected-warning@-1{{immutable value 'result' was never used; consider replacing with '_' or removing it}}
27
25
// expected-warning@-2{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
28
26
}
29
27
30
28
func testAsyncSequenceTypedPattern1<Seq:AsyncSequence>(_ seq:Seq)asyncthrowswhere Seq.Element ==Int{ // expected-note{{consider making generic parameter 'Seq' conform to the 'Sendable' protocol}} {{55-55=, Sendable}}
31
-
asynclet _:Int= seq.reduce(0){ $0 + $1 } // expected-error{{call can throw, but it is executed in a non-throwing autoclosure}} expected-note{{call is to 'rethrows' function, but a conformance has a throwing witness}}
29
+
asynclet _:Int= seq.reduce(0){ $0 + $1 } // OK
32
30
// expected-warning@-1{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
33
31
}
34
32
35
33
func testAsyncSequence<Seq:AsyncSequence>(_ seq:Seq)asyncthrowswhere Seq.Element ==Int{ // expected-note{{consider making generic parameter 'Seq' conform to the 'Sendable' protocol}} {{42-42=, Sendable}}
36
-
asyncletresult= seq.reduce(0){ $0 + $1 } // expected-error{{call can throw, but it is executed in a non-throwing autoclosure}} expected-note{{call is to 'rethrows' function, but a conformance has a throwing witness}}
34
+
asyncletresult= seq.reduce(0){ $0 + $1 } // OK
37
35
// expected-warning@-1{{initialization of immutable value 'result' was never used; consider replacing with assignment to '_' or removing it}}
38
36
// expected-warning@-2{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
39
37
}
40
38
41
39
func testAsyncSequence1<Seq:AsyncSequence>(_ seq:Seq)asyncthrowswhere Seq.Element ==Int{ // expected-note{{consider making generic parameter 'Seq' conform to the 'Sendable' protocol}} {{43-43=, Sendable}}
42
-
asynclet _ = seq.reduce(0){ $0 + $1 } // expected-error{{call can throw, but it is executed in a non-throwing autoclosure}} expected-note{{call is to 'rethrows' function, but a conformance has a throwing witness}}
40
+
asynclet _ = seq.reduce(0){ $0 + $1 } // OK
43
41
// expected-warning@-1{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
0 commit comments