- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
less unsoundnessness
Mon, 2009-07-06, 00:37
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.
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