summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-09-04 17:55:46 +0000
committerBurak Emir <emir@epfl.ch>2007-09-04 17:55:46 +0000
commit4d9354ae14d581fb548d1e926fbf3adb7d3bf615 (patch)
treee49c4951509819268d7460d814a5641f93ce6168
parent92629629ab76311540303f6644f5f336a6fe81d3 (diff)
downloadscala-4d9354ae14d581fb548d1e926fbf3adb7d3bf615.tar.gz
scala-4d9354ae14d581fb548d1e926fbf3adb7d3bf615.tar.bz2
scala-4d9354ae14d581fb548d1e926fbf3adb7d3bf615.zip
fixed #11
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeInfo.scala2
-rw-r--r--test/files/run/patmatnew.scala31
2 files changed, 32 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
index b1347d6be7..25941d3081 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
@@ -215,7 +215,7 @@ abstract class TreeInfo {
private def isSimpleThrowable(tp: Type): Boolean = tp match {
case TypeRef(pre, sym, args) =>
(pre == NoPrefix || pre.widen.typeSymbol.isStatic) &&
- (sym isNonBottomSubClass definitions.ThrowableClass)
+ (sym isNonBottomSubClass definitions.ThrowableClass) && /* bq */ !sym.isTrait
case _ =>
false
}
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index c8ca9c19cb..b05da464a5 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -43,6 +43,7 @@ object Test extends TestConsoleMain {
Bug1094,
ClassDefInGuard,
Ticket2,
+ Ticket11,
Ticket37
)
@@ -589,6 +590,36 @@ object Test extends TestConsoleMain {
})
}}
+// #11
+
+ 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 Ticket11 extends TestCase("#11") {
+ override def runTest {
+ 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])
+ }
+ }
+ }
+ }
+ }
+
// #37
object Ticket37 extends TestCase("#37") {