« Return to Thread: [scala] Unsoundness in higher-order type parameters?

[scala] Re: Unsoundness in higher-order type parameters?

by Adriaan Moors-2 :: Rate this Message:

Reply to Author | View in Thread

Hi Vladimir,

I think this is ok. The kind of _ in _[X, Y <: X] is (X: *) -> *(Nothing, X) -> * 
The kind of _ in _[X, Y] is * -> * -> *
Now, * -> * -> * is a subkind of (X: *) -> *(Nothing, X) -> * , just like Any -> Any -> Any is a subtype of Any -> String -> Any.

Or am I missing something?

cheers,
adriaan

On Tue, Jun 16, 2009 at 2:31 PM, Vladimir Reshetnikov <v.reshetnikov@...> wrote:
Hi,

Consider these definitions:

///////////////////////////////////////
trait A[B[_[X, Y <: X]]] {
 def f() : B[P]
}

trait C[_[X, Y]]

trait P[X, Y <: X]
///////////////////////////////////////

Type application C[P] is (correctly) rejected by the Scala 2.7.5
compiler. But A[C] is (incorrectly) accepted, which results in
incorrect type of member f(). It looks like unsoundness.

Thanks,
Vladimir


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

 « Return to Thread: [scala] Unsoundness in higher-order type parameters?