reactor / reactor-kotlin-extensions

Reactor Kotlin Support
Apache License 2.0
143 stars 21 forks source link

Tuple destructuring declarations are not working because of missing component* methods #56

Closed marcelkliemannel closed 1 year ago

marcelkliemannel commented 1 year ago

Hi,

I would like to use destructuring declarations with the reactor.util.function.Tuple* classes. But only the destruction of a Tuple2 works, but not with Tuple3 and upwards.

The problem is that in the TupleExtensions.kt there are some component* methods missing. So there is, for example, a https://github.com/reactor/reactor-kotlin-extensions/blob/0adcfd6a05390d4e83847a0371696aa274affa81/src/main/kotlin/reactor/kotlin/core/util/function/TupleExtensions.kt#L44 for the third parameter of a Tuple3, but the methods for the first and second are missing:

operator fun <T> Tuple3<T, *, *>.component1(): T = t1
operator fun <T> Tuple3<*, T, *>.component2(): T = t2

(I could create a PR with a fix.)

Best Regards, Marcel

marcelkliemannel commented 1 year ago

Sry, this is not a bug after all. I have not considered the inheritance hierarchy of the Tuple*s correctly...