Skip to content

Commit 9a52dbb

Browse files
committed
Use new inference
1 parent 91b29b0 commit 9a52dbb

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

kotlinx-coroutines-async/src/test/kotlin/AsyncIOTest.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package kotlinx.coroutines.asyncIO
22

33
import kotlinx.coroutines.*
4-
import kotlinx.coroutines.async
54
import org.apache.commons.io.FileUtils
65
import org.junit.Rule
76
import org.junit.Test
@@ -36,7 +35,7 @@ class AsyncIOTest {
3635
outputFile.toPath(),
3736
StandardOpenOption.CREATE, StandardOpenOption.WRITE)
3837
val buf = ByteBuffer.allocate(1024)
39-
val future = async<Unit> {
38+
val future = async {
4039
var totalBytesRead = 0L
4140
var totalBytesWritten = 0L
4241
while (totalBytesRead < input.size()) {
@@ -69,7 +68,7 @@ class AsyncIOTest {
6968
.bind(InetSocketAddress(8080))
7069

7170
threadPool.submit {
72-
async<Unit> {
71+
async {
7372
val client = serverChannel.aAccept()
7473
val buffer = ByteBuffer.allocate(2)
7574
client.aRead(buffer)
@@ -81,7 +80,7 @@ class AsyncIOTest {
8180
}
8281
}
8382

84-
async<Unit> {
83+
async {
8584
val connection =
8685
AsynchronousSocketChannel.open()
8786
// async calls

kotlinx-coroutines-async/src/test/kotlin/AsyncTest.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import kotlin.test.fail
1212
class AsyncTest {
1313
@Test
1414
fun testSimple() {
15-
val future = async<String> {
15+
val future = async {
1616
CompletableFuture.supplyAsync {
1717
"O"
1818
}.await() + "K"
@@ -24,7 +24,7 @@ class AsyncTest {
2424
@Test
2525
fun testWaitForCompletion() {
2626
val toAwait = CompletableFuture<String>()
27-
val future = async<String> {
27+
val future = async {
2828
toAwait.await() + "K"
2929
}
3030

@@ -53,7 +53,7 @@ class AsyncTest {
5353

5454
@Test
5555
fun testExceptionInsideCoroutine() {
56-
val future = async<String> {
56+
val future = async {
5757
if (CompletableFuture.supplyAsync { true }.await()) {
5858
throw IllegalStateException("OK")
5959
}
@@ -73,7 +73,7 @@ class AsyncTest {
7373
fun testContinuationWrapped() {
7474
val depth = AtomicInteger()
7575

76-
val future = async<String>(continuationWrapper = {
76+
val future = async(continuationWrapper = {
7777
depth.andIncrement
7878
it()
7979
depth.andDecrement

kotlinx-coroutines-generate/src/test/kotlin/GenerateTest.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import kotlin.test.assertTrue
1010
class GenerateTest {
1111
@Test
1212
fun testSimple() {
13-
val result = generate<Int> {
13+
val result = generate {
1414
for (i in 1..3) {
1515
yield(2 * i)
1616
}
@@ -23,7 +23,7 @@ class GenerateTest {
2323

2424
@Test
2525
fun testCallHasNextSeveralTimes() {
26-
val result = generate<Int> {
26+
val result = generate {
2727
yield(1)
2828
}
2929

@@ -44,7 +44,7 @@ class GenerateTest {
4444

4545
@Test
4646
fun testManualIteration() {
47-
val result = generate<Int> {
47+
val result = generate {
4848
yield(1)
4949
yield(2)
5050
yield(3)
@@ -84,7 +84,7 @@ class GenerateTest {
8484
@Test
8585
fun testLaziness() {
8686
var sharedVar = -2
87-
val result = generate<Int> {
87+
val result = generate {
8888
while (true) {
8989
when (sharedVar) {
9090
-1 -> return@generate
@@ -116,7 +116,7 @@ class GenerateTest {
116116
@Test
117117
fun testExceptionInCoroutine() {
118118
var sharedVar = -2
119-
val result = generate<Int> {
119+
val result = generate {
120120
while (true) {
121121
when (sharedVar) {
122122
-1 -> return@generate
@@ -138,7 +138,7 @@ class GenerateTest {
138138
@Test
139139
fun testParallelIteration() {
140140
var inc = 0
141-
val result = generate<Int> {
141+
val result = generate {
142142
for (i in 1..3) {
143143
inc++
144144
yield(inc * i)

kotlinx-coroutines-rx-example/src/main/kotlin/main.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fun main(args: Array<String>) {
3232

3333
val github = retrofit.create(GitHub::class.java)
3434

35-
asyncRx<Unit> {
35+
asyncRx {
3636
val contributors =
3737
github.contributors("JetBrains", "Kotlin")
3838
.awaitSingle().take(10)

kotlinx-coroutines-rx/src/test/kotlin/AsyncRxTest.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import kotlin.test.fail
99
class AsyncRxTest {
1010
@Test
1111
fun testSingle() {
12-
val observable = asyncRx<String> {
12+
val observable = asyncRx {
1313
Observable.just("O").awaitSingle() + "K"
1414
}
1515

@@ -20,7 +20,7 @@ class AsyncRxTest {
2020

2121
@Test
2222
fun testSingleWithDelay() {
23-
val observable = asyncRx<String> {
23+
val observable = asyncRx {
2424
Observable.timer(50, TimeUnit.MILLISECONDS).map { "O" }.awaitSingle() + "K"
2525
}
2626

@@ -32,7 +32,7 @@ class AsyncRxTest {
3232

3333
@Test
3434
fun testSingleException() {
35-
val observable = asyncRx<String> {
35+
val observable = asyncRx {
3636
Observable.just("O", "K").awaitSingle() + "K"
3737
}
3838

@@ -43,7 +43,7 @@ class AsyncRxTest {
4343

4444
@Test
4545
fun testAwaitFirst() {
46-
val observable = asyncRx<String> {
46+
val observable = asyncRx {
4747
Observable.just("O", "#").awaitFirst() + "K"
4848
}
4949

@@ -54,7 +54,7 @@ class AsyncRxTest {
5454

5555
@Test
5656
fun testAwaitLast() {
57-
val observable = asyncRx<String> {
57+
val observable = asyncRx {
5858
Observable.just("#", "O").awaitLast() + "K"
5959
}
6060

@@ -65,7 +65,7 @@ class AsyncRxTest {
6565

6666
@Test
6767
fun testExceptionFromObservable() {
68-
val observable = asyncRx<String> {
68+
val observable = asyncRx {
6969
try {
7070
Observable.error<String>(RuntimeException("O")).awaitFirst()
7171
} catch (e: RuntimeException) {
@@ -80,7 +80,7 @@ class AsyncRxTest {
8080

8181
@Test
8282
fun testExceptionFromCoroutine() {
83-
val observable = asyncRx<String> {
83+
val observable = asyncRx {
8484
error(Observable.just("O").awaitSingle() + "K")
8585
}
8686

@@ -92,7 +92,7 @@ class AsyncRxTest {
9292

9393
@Test
9494
fun testApplyForEachAndWait() {
95-
val observable = asyncRx<String> {
95+
val observable = asyncRx {
9696
var result = ""
9797

9898
Observable.just("O", "K").applyForEachAndAwait {
@@ -109,7 +109,7 @@ class AsyncRxTest {
109109

110110
@Test
111111
fun testApplyForEachAndWaitException() {
112-
val observable = asyncRx<String> {
112+
val observable = asyncRx {
113113
try {
114114
Observable.error<String>(RuntimeException("OK")).applyForEachAndAwait {
115115
fail("Should not be here")

0 commit comments

Comments
 (0)