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
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
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
-
// expected-warning@-2{{capture of 'seq' with non-sendable type 'Seq' in a `@Sendable` closure}}
25
+
// expected-warning@-2{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
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
29
asynclet _:Int= seq.reduce(0){ $0 + $1 } // OK
32
-
// expected-warning@-1{{capture of 'seq' with non-sendable type 'Seq' in a `@Sendable` closure}}
30
+
// expected-warning@-1{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
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
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
-
// expected-warning@-2{{capture of 'seq' with non-sendable type 'Seq' in a `@Sendable` closure}}
36
+
// expected-warning@-2{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
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
40
asynclet _ = seq.reduce(0){ $0 + $1 } // OK
43
-
// expected-warning@-1{{capture of 'seq' with non-sendable type 'Seq' in a `@Sendable` closure}}
41
+
// expected-warning@-1{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
42
+
}
43
+
44
+
func testAsyncSequence3<Seq>(_ seq:Seq)asyncthrowswhere Seq:AsyncSequence, Seq.Element ==Int{ // expected-note{{consider making generic parameter 'Seq' conform to the 'Sendable' protocol}} {{28-28=: Sendable}}
45
+
asyncletresult= seq // expected-warning{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
46
+
//expected-warning@-1{{initialization of immutable value 'result' was never used; consider replacing with assignment to '_' or removing it}}
47
+
}
48
+
49
+
func testAsyncSequence4<Seq>(_ seq:Seq)asyncthrowswhere Seq:AsyncSequence, Seq.Element ==Int{ // expected-note{{consider making generic parameter 'Seq' conform to the 'Sendable' protocol}} {{28-28=: Sendable}}
50
+
asynclet _ = seq // expected-warning{{capture of 'seq' with non-sendable type 'Seq' in 'async let' binding}}
0 commit comments