File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift -disable-availability-checking
2
+ // REQUIRES: concurrency
3
+
4
+ func testAsyncSequenceTypedPattern< Seq: AsyncSequence > ( _ seq: Seq ) async throws where Seq. Element == Int {
5
+ async let result : Int = seq. reduce ( 0 ) { $0 + $1 } // OK
6
+ // expected-warning@-1{{immutable value 'result' was never used; consider replacing with '_' or removing it}}
7
+ }
8
+
9
+ func testAsyncSequenceTypedPattern1< Seq: AsyncSequence > ( _ seq: Seq ) async throws where Seq. Element == Int {
10
+ async let _: Int = seq. reduce ( 0 ) { $0 + $1 } // OK
11
+ }
12
+
13
+ func testAsyncSequence< Seq: AsyncSequence > ( _ seq: Seq ) async throws where Seq. Element == Int {
14
+ async let result = seq. reduce ( 0 ) { $0 + $1 } // OK
15
+ // expected-warning@-1{{initialization of immutable value 'result' was never used; consider replacing with assignment to '_' or removing it}}
16
+ }
17
+
18
+ func testAsyncSequence1< Seq: AsyncSequence > ( _ seq: Seq ) async throws where Seq. Element == Int {
19
+ async let _ = seq. reduce ( 0 ) { $0 + $1 } // OK
20
+ }
You can’t perform that action at this time.
0 commit comments