I'm having problems in Scala 2.9.2, which implements a method that declares a dependent return type. Following code
object DependentTypesQuestion {
def ??? = throw new UnsupportedOperationException
trait X {
trait Y
}
trait Z {
def z(x: X): x.Y
}
object Z extends Z {
override def z(x: X): x.Y = ???
}
}
in section 2.9.2 displays the following error message at compile time:
overriding method z in trait Z of type (x: DependentTypesQuestion.X)x.Y; method z has incompatible type
In 2.10.0-M4, the problem seems to be fixed, but unfortunately my project is now tied to 2.9.
Is there a way around this problem in 2.9.2?
(Alternatively, is there any perspective in 2.9.3 that includes a fix with feedback from 2.10?)
source
share