No, # is a type projection. In your case, however, this does not work because K does not determine the type of BAR.
trait A {
type T
def apply():T
}
trait MyClass[X<:A] {
type SomeType = X
def applySeq():Traversable[SomeType]
}
class AImpl extends A {
type T=Int
def apply():Int = 10
}
class MyClassImpl extends MyClass[AImpl] {
def applySeq(): Traversable[SomeType] = List(10)
}
Basically, you can use type T inside MyClass.
In fact, also the following compiler:
class MyClassImpl extends MyClass[AImpl] {def applySeq(): Traversable[Int] = List(10)}
source
share