This page is no longer maintained — Please continue to the home page at www.scala-lang.org

less unsoundnessness

1 reply
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.

I just committed a fix for this:

http://lampsvn.epfl.ch/trac/scala/ticket/1503

I believe it is correct. I had to comment out some of the
patmatnew.scala test case because it was testing for the existence of
the very behavior which no longer exists.

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: less unsoundnessness

On Mon, Jul 6, 2009 at 1:37 AM, Paul Phillips wrote:
> I just committed a fix for this:
>
>  http://lampsvn.epfl.ch/trac/scala/ticket/1503
>
> I believe it is correct.  I had to comment out some of the
> patmatnew.scala test case because it was testing for the existence of
> the very behavior which no longer exists.

The fix looks OK. I am still not quite sure which solution to pick, though.
In a pattern match

foo match {
case x @ bar => ...
}

we could either require that the runtime type of foo is a subtype of
the static type of bar (that's the patch you have applied), or we
could be conservative and assume for x only the expected type of the
pattern bar, not the actual type. Then any equality method would do.
But I am not sure whether this would break a lot of code (I suspect it
would but can't put my finger on it).

Cheers

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland