code |
The new exception matching code works great (thank you!) but I recently
found another case that fails. This is with 2.6.0-RC1.
The following code shows that all exceptions match the first catch
clause. This ticket may be considered a follow up to
http://scala-webapps.epfl.ch/bugtracking/contribs/display.do?id=649
http://scala-webapps.epfl.ch/bugtracking/bugs/displayItem.do?id=1168
Regards,
Blair
class MyException1 extends Exception
// Commenting out the following line and uncommenting the second line
// will cause the test to succeed.
trait SpecialException extends MyException1
// trait SpecialException
class MyException2 extends MyException1 with SpecialException
object Test extends Application
{
Array[Throwable](new Exception("abc"),
new MyException1,
new MyException2).foreach { e =>
try {
throw e
}
catch {
case e : SpecialException => {
assume(e.isInstanceOf[SpecialException])
}
case e => {
assume(e.isInstanceOf[Throwable])
}
}
}
}
|