diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeInfo.scala | 2 | ||||
-rw-r--r-- | test/files/run/patmatnew.scala | 31 |
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") { |