Skip to content

Commit

Permalink
Fix KDoc of Either's combine method (#3486)
Browse files Browse the repository at this point in the history
Either.combine's method description contains an error. It states:

"... otherwise it returns the `this` or fallbacks to [other] in case `this` is [Left]"

But the opposite is true: it returns this if this is Left and other if other is Left.
  • Loading branch information
ruben-personio authored Sep 10, 2024
1 parent a78aa90 commit 3521236
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ public operator fun <A : Comparable<A>, B : Comparable<B>> Either<A, B>.compareT
/**
* Combine two [Either] values.
* If both are [Right] then combine both [B] values using [combineRight] or if both are [Left] then combine both [A] values using [combineLeft],
* otherwise it returns the `this` or fallbacks to [other] in case `this` is [Left].
* otherwise return the sole [Left] value (either `this` or [other]).
*/
public fun <A, B> Either<A, B>.combine(other: Either<A, B>, combineLeft: (A, A) -> A, combineRight: (B, B) -> B): Either<A, B> =
when (val one = this) {
Expand Down

0 comments on commit 3521236

Please sign in to comment.