Recursively boxing Kotlin nested value classes
This commit is a follow-up to gh-34592. It introduces recursive boxing of Kotlin nested value classes in CoroutinesUtils. Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com> Closes gh-34682
This commit is contained in:
committed by
Sébastien Deleuze
parent
7b08feeb6d
commit
fbaeaf12bd
@@ -199,6 +199,15 @@ class CoroutinesUtilsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun invokeSuspendingFunctionWithNestedValueClassParameter() {
|
||||
val method = CoroutinesUtilsTests::class.java.declaredMethods.first { it.name.startsWith("suspendingFunctionWithNestedValueClassParameter") }
|
||||
val mono = CoroutinesUtils.invokeSuspendingFunction(method, this, "foo", null) as Mono
|
||||
runBlocking {
|
||||
Assertions.assertThat(mono.awaitSingle()).isEqualTo("foo")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun invokeSuspendingFunctionWithValueClassReturnValue() {
|
||||
val method = CoroutinesUtilsTests::class.java.declaredMethods.first { it.name.startsWith("suspendingFunctionWithValueClassReturnValue") }
|
||||
@@ -328,6 +337,11 @@ class CoroutinesUtilsTests {
|
||||
return value.value
|
||||
}
|
||||
|
||||
suspend fun suspendingFunctionWithNestedValueClassParameter(value: NestedValueClass): String {
|
||||
delay(1)
|
||||
return value.value.value
|
||||
}
|
||||
|
||||
suspend fun suspendingFunctionWithValueClassReturnValue(): ValueClass {
|
||||
delay(1)
|
||||
return ValueClass("foo")
|
||||
@@ -382,6 +396,9 @@ class CoroutinesUtilsTests {
|
||||
@JvmInline
|
||||
value class ValueClass(val value: String)
|
||||
|
||||
@JvmInline
|
||||
value class NestedValueClass(val value: ValueClass)
|
||||
|
||||
@JvmInline
|
||||
value class ValueClassWithInit(val value: String) {
|
||||
init {
|
||||
|
||||
Reference in New Issue
Block a user