summaryrefslogtreecommitdiff
path: root/test/files/run/t6911.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-03 20:35:22 -0800
committerPaul Phillips <paulp@improving.org>2013-01-03 23:38:51 -0800
commiteeb6ee6eb21e7bd473ab5775474444b5d1b72856 (patch)
treeec58c47937d7544d6f0b2563bcaaee04c605da74 /test/files/run/t6911.scala
parente112ac94d04be7ee715ebf8724709123b0f3e1f6 (diff)
downloadscala-eeb6ee6eb21e7bd473ab5775474444b5d1b72856.tar.gz
scala-eeb6ee6eb21e7bd473ab5775474444b5d1b72856.tar.bz2
scala-eeb6ee6eb21e7bd473ab5775474444b5d1b72856.zip
SI-6911, regression in generated case class equality.
Caught out by the different semantics of isInstanceOf and pattern matching. trait K { case class CC(name: String) } object Foo extends K object Bar extends K Foo.CC("a") == Bar.CC("a") That expression is supposed to be false, and with this commit it is once again.
Diffstat (limited to 'test/files/run/t6911.scala')
-rw-r--r--test/files/run/t6911.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/files/run/t6911.scala b/test/files/run/t6911.scala
new file mode 100644
index 0000000000..dd81257a96
--- /dev/null
+++ b/test/files/run/t6911.scala
@@ -0,0 +1,24 @@
+trait K {
+ case class CC(name: String)
+ case class DD[+A1, A2](x1: A1, x2: A2)
+}
+
+object Test {
+ object Foo extends K
+ object Bar extends K
+
+ val b1 = Foo.CC("b")
+ val b2 = Bar.CC("b")
+ val b3 = Foo.CC("b")
+
+ val c1 = Foo.DD("a", 5)
+ val c2 = Bar.DD("a", 5)
+ val c3 = Foo.DD("a", 5)
+
+ def main(args: Array[String]): Unit = {
+ assert(b1 != b2, ((b1, b2))) // false under 2.9, true under 2.10-RC5
+ assert(b1 == b3, ((b1, b3)))
+ assert(c1 != c2, ((c1, c2)))
+ assert(c1 == c3, ((c1, c3)))
+ }
+}