From 20e20196473e16ace8e29ad8f85a9ec79af043aa Mon Sep 17 00:00:00 2001 From: buraq Date: Fri, 10 Jun 2005 16:37:26 +0000 Subject: fixed bugs #406 #440 #371 --- test/files/run/regularpatmat.check | 5 ++++- test/files/run/regularpatmat.scala | 39 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) (limited to 'test/files') diff --git a/test/files/run/regularpatmat.check b/test/files/run/regularpatmat.check index 7c6f67ea71..3417d9a98a 100644 --- a/test/files/run/regularpatmat.check +++ b/test/files/run/regularpatmat.check @@ -102,7 +102,10 @@ passed ok passed ok passed ok passed ok -testMZ - bugs #132 #133b #180 #195 #196 +testMZ - bugs #132 #133b #180 #195 #196 #398 #406 #441 +passed ok +passed ok +passed ok passed ok passed ok passed ok diff --git a/test/files/run/regularpatmat.scala b/test/files/run/regularpatmat.scala index 6847861d4d..f6991cab5c 100644 --- a/test/files/run/regularpatmat.scala +++ b/test/files/run/regularpatmat.scala @@ -667,8 +667,41 @@ object testMZ { case x::xs => "two" } + def mat406() = { + class Type; + case class A() extends Type; + case class B() extends Type; + case class C() extends Type; + + def foo(x: Type, y: Type): String = Pair(x, y) match { + case Pair(A(), A()) + | Pair(A(), B()) + | Pair(B(), A()) + | Pair(B(), B()) => "3" + case Pair(C(), C()) => "4" + case Pair(A(), _) + | Pair(B(), _) => "7" + case _ => "8" + } + + foo(A(), C()) + } + + def mat441() = { + val tata = 1; + val titi = 0.8 + Math.random(); + try { + tata match { + case 1 if (titi < 0.5) => "a" + case 0 | 1 => "b" + } + } catch { + case _ => "c" + } + } + def main:Unit = { - Console.println("testMZ - bugs #132 #133b #180 #195 #196"); + Console.println("testMZ - bugs #132 #133b #180 #195 #196 #398 #406 #441"); assertEquals(testFoo( List(Two(),Two(),Two(),Two()) ),"b = Two"); assertEquals(testFoo( List(Two(),Two(),Two()) ),"a = Two"); assertEquals(testFoo( List(Two(),Two()) ),"a = Two"); @@ -687,7 +720,9 @@ object testMZ { assertEquals(mat196( List(1) ),"default"); assertEquals(mat196( List() ),"case, b = List()"); assertEquals(mat398( List(2) ),"two"); - + assertEquals(mat398( List(2) ),"two"); + assertEquals(mat406(), "7"); + assertEquals(mat441(), "b"); () } -- cgit v1.2.3