@@ -26,9 +26,7 @@ final class BackendReportingImpl(val global: Global) extends BackendReporting {
26
26
/**
27
27
* Utilities for error reporting.
28
28
*
29
- * Defines some tools to make error reporting with Either easier. Would be subsumed by a right-biased
30
- * Either in the standard library (or scalaz \/) (Validation is different, it accumulates multiple
31
- * errors).
29
+ * Defines some utility methods to make error reporting with Either easier.
32
30
*/
33
31
object BackendReporting {
34
32
def methodSignature (classInternalName : InternalName , name : String , desc : String ) = {
@@ -42,19 +40,12 @@ object BackendReporting {
42
40
def assertionError (message : String ): Nothing = throw new AssertionError (message)
43
41
44
42
implicit class RightBiasedEither [A , B ](val v : Either [A , B ]) extends AnyVal {
45
- def map [C ](f : B => C ): Either [A , C ] = v.right.map(f)
46
- def flatMap [C ](f : B => Either [A , C ]): Either [A , C ] = v.right.flatMap(f)
47
43
def withFilter (f : B => Boolean )(implicit empty : A ): Either [A , B ] = v match {
48
44
case Left (_) => v
49
45
case Right (e) => if (f(e)) v else Left (empty) // scalaz.\/ requires an implicit Monoid m to get m.empty
50
46
}
51
- def foreach [U ](f : B => U ): Unit = v.right.foreach(f)
52
47
53
- def getOrElse [C >: B ](alt : => C ): C = v.right.getOrElse(alt)
54
-
55
- /**
56
- * Get the value, fail with an assertion if this is an error.
57
- */
48
+ /** Get the value, fail with an assertion if this is an error. */
58
49
def get : B = {
59
50
assert(v.isRight, v.left.get)
60
51
v.right.get
0 commit comments