Skip to content

Commit c1e2c7d

Browse files
[SR-15049] Adding regression tests for ticket
1 parent b386d5d commit c1e2c7d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/Concurrency/sr15049.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
}

0 commit comments

Comments
 (0)