« Return to Thread: [scala] is this a bug?

Re: [scala] Re: is this a bug?

by Adriaan Moors-2 :: Rate this Message:

Reply to Author | View in Thread

Hint:

trait T[A[Int] <: T[A, B], B]

is equivalent to

trait T[A[X] <: T[A, B], B]

it's like writing

def foo[Int](x: Int): Int,

which in turn is equivalent to

def foo[T](x: T): T

when you write an identifier in a position where a type parameter is expected, you introduce a new variable (thus, the "Int" in the above snippets does not refer to the existing type Int, but is just some type parameter with an unfortunate name)

hth
adriaan

On Fri, Jun 26, 2009 at 9:06 AM, Jesper Nordenberg <megagurka@...> wrote:
Jesper Nordenberg wrote:
- For all C "T2[C] <: T[T2, B]" must hold, which clearly is not true and would indicate a compiler bug.

Here's an even more contrived example:

trait T[A[Int] <: T[A, B], B]
class T2[B] extends T[T2, B]
new T2[Float]

This basically says that "T2[Int] <: T[T2, Float]" which obviously isn't true, so there's seems to be some checks missing in the compiler.


/Jesper Nordenberg


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

 « Return to Thread: [scala] is this a bug?