Skip to content

Commit 06ffeff

Browse files
authored
Merge pull request scala/scala#6682 from martijnhoekstra/eitherprojections
deprecate either projections
2 parents 4c8facf + 7532bca commit 06ffeff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/src/scala/util/Either.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,14 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
161161
* for (e <- interactWithDB(someQuery).left) log(s"query failed, reason was $e")
162162
* }}}
163163
*/
164+
@deprecated("use swap instead", "2.13.0")
164165
def left = Either.LeftProjection(this)
165166

166167
/** Projects this `Either` as a `Right`.
167168
*
168169
* Because `Either` is right-biased, this method is not normally needed.
169170
*/
171+
@deprecated("Either is now right-biased", "2.13.0")
170172
def right = Either.RightProjection(this)
171173

172174
/** Applies `fa` if this is a `Left` or `fb` if this is a `Right`.
@@ -508,6 +510,7 @@ object Either {
508510
* @author <a href="mailto:research@workingmouse.com">Tony Morris</a>, Workingmouse
509511
* @see [[scala.util.Either#left]]
510512
*/
513+
@deprecated("use swap instead", "2.13.0")
511514
final case class LeftProjection[+A, +B](e: Either[A, B]) {
512515
/** Returns the value from this `Left` or throws `java.util.NoSuchElementException`
513516
* if this is a `Right`.
@@ -651,6 +654,7 @@ object Either {
651654
*
652655
* @author <a href="mailto:research@workingmouse.com">Tony Morris</a>, Workingmouse
653656
*/
657+
@deprecated("Either is now right-biased", "2.13.0")
654658
final case class RightProjection[+A, +B](e: Either[A, B]) {
655659

656660
/** Returns the value from this `Right` or throws

0 commit comments

Comments
 (0)