I was pretty sure that there was already a bug filed, but even after searching for it multiple times, I can't find it.
The following (minimized) code compiled with 2.9, but fails to compile with 2.10:
trait TFn1[I] { type In = I } trait >>[F1 <: TFn1[_], F2 <: TFn1[_]] extends TFn1[F1#In]
<console>:8: error: illegal inheritance; self-type >>[F1,F2] does not conform to TFn1[_$1]'s selftype TFn1[_$1] trait >>[F1 <: TFn1[_], F2 <: TFn1[_]] extends TFn1[F1#In] ^ Does someone maybe remember the ticket number or should I file a new one?
Thanks! That's good to know. I think there's not much we can do here for
the moment. The patch is necessary because it fixes an unsoundness problem.
I am not quite clear what the breaking code does. It looks like it can be
compiled if we can get rid of unrestricted existentials. But this will be
definitely post 2.10.
On Thu, Aug 9, 2012 at 3:43 AM, martin odersky <martin.oder...@epfl.ch>wrote:
> Thanks! That's good to know. I think there's not much we can do here for
> the moment. The patch is necessary because it fixes an unsoundness problem.
> I am not quite clear what the breaking code does. It looks like it can be
> compiled if we can get rid of unrestricted existentials. But this will be
> definitely post 2.10.
In the meantime, these variations still compile:
// 1
trait TFn1[I] { type In <: I }
trait >>[F1 <: TFn1[_], F2 <: TFn1[_]] extends TFn1[F1#In]
// 2
trait TFn1[I] { type In0 <: I ; type In = In0 }
trait >>[F1 <: TFn1[_], F2 <: TFn1[_]] extends TFn1[F1#In0]
> On Thu, Aug 9, 2012 at 3:43 AM, martin odersky <martin....@epfl.ch<javascript:> > > wrote:
>> Thanks! That's good to know. I think there's not much we can do here for >> the moment. The patch is necessary because it fixes an unsoundness problem. >> I am not quite clear what the breaking code does. It looks like it can be >> compiled if we can get rid of unrestricted existentials. But this will be >> definitely post 2.10.
> In the meantime, these variations still compile:
> // 1 > trait TFn1[I] { type In <: I } > trait >>[F1 <: TFn1[_], F2 <: TFn1[_]] extends TFn1[F1#In]
> // 2 > trait TFn1[I] { type In0 <: I ; type In = In0 } > trait >>[F1 <: TFn1[_], F2 <: TFn1[_]] extends TFn1[F1#In0]
<console>:18: error: type arguments [Arg] do not conform to type Apply's type parameter bounds [T <: TFn1B.this.In] type ->[Arg, F <: TFn1[Arg, _]] = F#Apply[Arg] ^ <console>:21: error: overriding type Apply in trait TFn1B with bounds[T <:
>>.this.In] <: >>.this.Out;
type Apply has incompatible type type Apply[T] = F2#Apply[F1#Apply[T]] ^ <console>:21: error: type arguments [F1#Apply[T]] do not conform to type Apply's type parameter bounds [T <: TFn1B.this.In] type Apply[T] = F2#Apply[F1#Apply[T]] ^
On Thu, Aug 9, 2012 at 11:31 AM, Simon Ochsenreither <
simon.ochsenreit...@gmail.com> wrote:
> What do you think?
Well, it's not for the faint of heart. It looks to me like the former
version was unsound, so some of these changes are legitimate. The fact
that I have to "override type" should be a bug. But at least it works (I
mean, compiles.)
object Functions {
trait TFn1B {
type In
type Out
type Apply[T <: In] <: Out
}
trait TFn1[I, O] extends TFn1B {
type In >: I
type Out <: O
}
type ->[Arg, F <: TFn1[Arg, _]] = F#Apply[Arg]
trait >>[F1 <: TFn1[_, _ <: F2#In], F2 <: TFn1[_, _]] extends TFn1[F1#In,
F2#Out] {
override type In = F1#In
override type Out = F2#Out
type Apply[T <: In] = F2#Apply[F1#Apply[T]]
}