https://lampsvn.epfl.ch/trac/scala/ticket/2080Thanks,
Vladimir
On 6/19/09, Ingo Maier <
ingo.maier@...> wrote:
> This is a compiler bug. I don't know why the override modifier is
> allowed for member traits, I don't think it should. However, you don't
> even need the override. The following compiles:
>
> trait A {
> type T
> def t: T
> }
>
> trait B extends A {
> trait T {
> def f {}
> }
> }
>
> object C extends B {
> trait T {
> def g {}
> }
> def t = new T {}
> }
>
> but when you call C.t, you get a CCE since C.T and A.T are not
> compatible. Please file a ticket, if there isn't already one.
>
> Thanks
>
> Ingo
>
> Vladimir Reshetnikov wrote:
>> Hi,
>>
>> I need help to gain some intuition behind virtual types. Consider this
>> code:
>>
>> ///////////////////////////////////////////////////
>> trait A {
>> type T
>> def f(x : T) : T
>> }
>>
>> trait B extends A {
>> trait T { }
>> override def f(x : T) : T = x
>> }
>>
>> object C extends B {
>> override trait T {
>> def g { }
>> }
>> override def f(x : T) : T = { x.g; x }
>> }
>>
>> ///////////////////////////////////////////////////
>>
>> Which members are overridden by the members T and f in the object C?
>> Are those T and f in trait B?
>> How is it possible to override trait T in B with completely unrelated
>> trait T in C?
>>
>>
>> Thanks,
>> Vladimir
>> .
>>
>
>