Skip to content

Commit

Permalink
Remove references to shift in Either.kt (#3105)
Browse files Browse the repository at this point in the history
  • Loading branch information
nomisRev authored Jul 24, 2023
1 parent 9286176 commit e2a771d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2428,7 +2428,7 @@ public fun <E> E.leftNel(): EitherNel<E, Nothing> =
*
* fun test() {
* val error: Either<String, Int> = Either.Left("error")
* val listOfErrors: Either<List<Char>, Int> = error.recover { shift(it.toList()) }
* val listOfErrors: Either<List<Char>, Int> = error.recover { raise(it.toList()) }
* listOfErrors shouldBe Either.Left(listOf('e', 'r', 'r', 'o', 'r'))
* }
* ```
Expand Down Expand Up @@ -2459,7 +2459,7 @@ public inline fun <E, EE, A> Either<E, A>.recover(@BuilderInference recover: Rai
* val left: Either<Throwable, Int> = Either.catch { throw RuntimeException("Boom!") }
*
* val caught: Either<Nothing, Int> = left.catch { _: RuntimeException -> 1 }
* val failure: Either<String, Int> = left.catch { _: RuntimeException -> shift("failure") }
* val failure: Either<String, Int> = left.catch { _: RuntimeException -> raise("failure") }
*
* shouldThrowUnit<RuntimeException> {
* val caught2: Either<Nothing, Int> = left.catch { _: IllegalStateException -> 1 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import io.kotest.matchers.shouldBe

fun test() {
val error: Either<String, Int> = Either.Left("error")
val listOfErrors: Either<List<Char>, Int> = error.recover { shift(it.toList()) }
val listOfErrors: Either<List<Char>, Int> = error.recover { raise(it.toList()) }
listOfErrors shouldBe Either.Left(listOf('e', 'r', 'r', 'o', 'r'))
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fun test() {
val left: Either<Throwable, Int> = Either.catch { throw RuntimeException("Boom!") }

val caught: Either<Nothing, Int> = left.catch { _: RuntimeException -> 1 }
val failure: Either<String, Int> = left.catch { _: RuntimeException -> shift("failure") }
val failure: Either<String, Int> = left.catch { _: RuntimeException -> raise("failure") }

shouldThrowUnit<RuntimeException> {
val caught2: Either<Nothing, Int> = left.catch { _: IllegalStateException -> 1 }
Expand Down

0 comments on commit e2a771d

Please sign in to comment.