From ccfb3b9c1697379335992b085368557297c72e2d Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 9 Jul 2009 15:07:05 +0000 Subject: The presently salvageable portion of my attempt... The presently salvageable portion of my attempt to fix bugs #425 and #816 (which I have indeed fixed, but a bazillion other test cases broke so the fix is commented out until I can make everyone happy at once.) --- test/pending/run/bugs425-and-816.scala | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/pending/run/bugs425-and-816.scala (limited to 'test/pending') diff --git a/test/pending/run/bugs425-and-816.scala b/test/pending/run/bugs425-and-816.scala new file mode 100644 index 0000000000..eb44787a72 --- /dev/null +++ b/test/pending/run/bugs425-and-816.scala @@ -0,0 +1,41 @@ +object Test { + object bug816 { + abstract class Atest(val data: String) + case class Btest(override val data: String, val b: Boolean) extends Atest(data) + case class Ctest(override val data: String) extends Btest(data, true) + + class testCaseClass { + def test(x: Atest) = x match { + case Ctest(data) => "C" + case Btest(data, b) => "B" + } + } + def go() = { + val tcc = new testCaseClass() + + tcc.test(Ctest("foo")) + tcc.test(Btest("bar", true)) + } + } + + object bug425 { + case class A(x: Int) + case class B(override val x: Int, y: Double) extends A(x) + + val b: A = B(5, 3.3) + def flail = b match { + case B(x, y) => "B" + case A(x) => "A" + } + def flail2 = (B(10, 5.5): Any) match { + case A(20) => "1" + case A(10) => "2" + case _ => "fail" + } + def go() = flail + flail2 + } + + def main(args: Array[String]): Unit = { + assert(bug816.go() == "CB") + assert(bug425.go() == "B2") + } +} \ No newline at end of file -- cgit v1.2.3