Well... You haven't shown all your code, and the code you did show has some confusing inconsistencies. So this is going to be a wild guess. I suspect your problem is that Pipe
is invariant in its type parameter R
. Here's my simplified example:
case class Test[A](a: A)
object Test {
implicit class TestOps[A](val lhs: Test[A]) extends AnyVal {
def >->(rhs: Test[A]): Test[A] = ???
}
def test {
def lhs = Test(???)
def rhs = Test(???)
lhs >-> rhs
}
}
The compile error I get from this code is:
value >-> is not a member of Test[Nothing]
lhs >-> rhs
^
... which I admit is not the same as the error you posted. But I don't entirely trust what you posted, so I'm going to keep going! The fix for this is to make Test
covariant in its type parameter A
:
case class Test[+A](a: A)
I honestly don't understand why the compile error happens to begin with. It seems like the compiler doesn't want to unify A =:= Nothing
in the conversion to TestOps
, but I don't see why not. Nevertheless, Test
should be covariant in A
anyways, and I'm guessing your Pipe
class should likewise be covariant in R
.
Edit
I just spent a few minutes looking through the Scala bug list and found several possibly related issues: SI-1570, SI-4509, SI-4982 and SI-5505. I don't really know any details, but it sounds like Nothing
is treated specially and shouldn't be. Paul and Adriaan would be the guys to ask...