code |
/*
This issue is very minor, I'm only raising it in case it indicates an unexpected problem. I'm testing with the nightly snapshot 2.5.0.11868.20070531-045012
Martin:
Many thanks for the change you recently made for 'bug' #1119 "equivalent to requires for virtual types"
(It achieves what I was requesting:
In 2.5.0-final, derived classes might have to provide both a type selfType and a value self.
Now with your change, they only have to provide selfType.)
Regards,
Eric.
*/
class O
{
}
abstract class Factory
{
type clientType
def create(client: clientType): O
}
trait Client
{
type selfType >: this.type <: Client
def factories: List[Factory { type clientType >: selfType }] = Nil // no factories by default
// works
private val self: selfType = this
def selfOutputs: List[O] = factories.map(_.create(self))
// works
def annotatedThisOutputs: List[O] = factories.map(_.create(this: selfType))
// does not compile
def thisOutputs: List[O] = factories.map(_.create(this))
}
|