Skip to content

Commit 1a3a612

Browse files
authored
Merge pull request scala#5281 from dwijnand/either-value
Deprecate and rename Left#a/Right#b to Left#value/Right#value
2 parents ab83b26 + 841fb25 commit 1a3a612

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/library/scala/util/Either.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,11 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
345345
* @author <a href="mailto:[email protected]">Tony Morris</a>, Workingmouse
346346
* @version 1.0, 11/10/2008
347347
*/
348-
final case class Left[+A, +B](a: A) extends Either[A, B] {
348+
final case class Left[+A, +B](@deprecatedName('a, "2.12.0") value: A) extends Either[A, B] {
349349
def isLeft = true
350350
def isRight = false
351+
352+
@deprecated("Use .value instead.", "2.12.0") def a: A = value
351353
}
352354

353355
/**
@@ -356,9 +358,11 @@ final case class Left[+A, +B](a: A) extends Either[A, B] {
356358
* @author <a href="mailto:[email protected]">Tony Morris</a>, Workingmouse
357359
* @version 1.0, 11/10/2008
358360
*/
359-
final case class Right[+A, +B](b: B) extends Either[A, B] {
361+
final case class Right[+A, +B](@deprecatedName('b, "2.12.0") value: B) extends Either[A, B] {
360362
def isLeft = false
361363
def isRight = true
364+
365+
@deprecated("Use .value instead.", "2.12.0") def b: B = value
362366
}
363367

364368
object Either {

0 commit comments

Comments
 (0)