Skip to content

Commit

Permalink
update kotlinx-coroutines (#2912)
Browse files Browse the repository at this point in the history
* update kotlinx-coroutines

* create merge function

* clean up reference

* rm merge function and use copyforChild in mergeForChild

* clean up

* add annotation
  • Loading branch information
i-walker committed Apr 7, 2022
1 parent f1c729d commit b832d49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package io.kotest.assertions

import kotlinx.coroutines.CopyableThreadContextElement
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlin.coroutines.CoroutineContext

Expand Down Expand Up @@ -36,7 +37,7 @@ private class CoroutineLocalErrorCollector : BasicErrorCollector() {
}


@OptIn(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class, DelicateCoroutinesApi::class)
private class ErrorCollectorContextElement(private val coroutineLocalErrorCollector: CoroutineLocalErrorCollector) :
CopyableThreadContextElement<CoroutineLocalErrorCollector> {

Expand All @@ -52,9 +53,11 @@ private class ErrorCollectorContextElement(private val coroutineLocalErrorCollec
threadLocalErrorCollector.set(oldState)
}

override fun copyForChildCoroutine(): CopyableThreadContextElement<CoroutineLocalErrorCollector> {
return ErrorCollectorContextElement(threadLocalErrorCollector.get().copy())
}

companion object Key : CoroutineContext.Key<ErrorCollectorContextElement>

override fun copyForChild(): CopyableThreadContextElement<CoroutineLocalErrorCollector> =
ErrorCollectorContextElement(threadLocalErrorCollector.get().copy())

override fun mergeForChild(overwritingElement: CoroutineContext.Element): CoroutineContext =
copyForChild()
}
2 changes: 1 addition & 1 deletion versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ version.kotest.extensions.mockserver=1.0.1

version.kotlin=1.6.10

version.kotlinx.coroutines=1.6.0
version.kotlinx.coroutines=1.6.1

## unused
version.kotlinx.datetime=0.2.1
Expand Down

0 comments on commit b832d49

Please sign in to comment.