|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
[scala] Bounds on abstract typesHi,
Consider this code: //////////////////////////////////////// trait A { type T <: this.type with C } trait B extends A { type T <: this.type with C } trait C extends B { type T <: this.type with C } //////////////////////////////////////// Scala compiler rejects it: <console>:11: error: overriding type T in trait B with bounds >: Nothing <: C.this.type with C; type T has incompatible type type T <: this.type with C ^ But the following is accepted: //////////////////////////////////////// trait A { type T <: this.type with C } trait B extends A { type T <: this.type with C } trait C extends B { } //////////////////////////////////////// Can anybody explain, why? Thanks, Vladimir |
|
|
[scala] Re: [scala-user] Bounds on abstract typesOn Fri, Jun 19, 2009 at 6:15 PM, Vladimir
Reshetnikov<v.reshetnikov@...> wrote: > Hi, > > Consider this code: > > //////////////////////////////////////// > trait A { > type T <: this.type with C > } > > trait B extends A { > type T <: this.type with C > } > > trait C extends B { > type T <: this.type with C > } > //////////////////////////////////////// > > Scala compiler rejects it: > > <console>:11: error: overriding type T in trait B with bounds >: > Nothing <: C.this.type with C; > type T has incompatible type > type T <: this.type with C > ^ > > But the following is accepted: > > //////////////////////////////////////// > trait A { > type T <: this.type with C > } > > trait B extends A { > type T <: this.type with C > } > > trait C extends B { > } > //////////////////////////////////////// > > Can anybody explain, why? > > Thanks, > Vladimir > With 2.8 trunk (at least via the nightly eclipse build) this error doesn't occur. Are you using 2.7.x for testing this? |
|
|
[scala] Re: [scala-user] Bounds on abstract typesOh, my bad.
I used scala interpreter, so the first two C's were another C. Actually, it compiles without errors. Thanks, Vladimir On 6/19/09, Chris Twiner <chris.twiner@...> wrote: > On Fri, Jun 19, 2009 at 6:15 PM, Vladimir > Reshetnikov<v.reshetnikov@...> wrote: >> Hi, >> >> Consider this code: >> >> //////////////////////////////////////// >> trait A { >> type T <: this.type with C >> } >> >> trait B extends A { >> type T <: this.type with C >> } >> >> trait C extends B { >> type T <: this.type with C >> } >> //////////////////////////////////////// >> >> Scala compiler rejects it: >> >> <console>:11: error: overriding type T in trait B with bounds >: >> Nothing <: C.this.type with C; >> type T has incompatible type >> type T <: this.type with C >> ^ >> >> But the following is accepted: >> >> //////////////////////////////////////// >> trait A { >> type T <: this.type with C >> } >> >> trait B extends A { >> type T <: this.type with C >> } >> >> trait C extends B { >> } >> //////////////////////////////////////// >> >> Can anybody explain, why? >> >> Thanks, >> Vladimir >> > > With 2.8 trunk (at least via the nightly eclipse build) this error > doesn't occur. Are you using 2.7.x for testing this? > |
| Free embeddable forum powered by Nabble | Forum Help |