From e412524fee20da975954c929893e88db17dbdd9a Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 26 Sep 2011 23:49:03 +0000 Subject: ProductN, and method synthesis toolbox. - Finished giving case classes a ProductN parent, and flipped it on. The "finish" part involved not breaking existing code where case classes manually extend the appropriate ProductN. (Like, Tuple 1-22.) - Generalized most of SyntheticMethods to ease method creation and class manipulation in general. - Fixed bugs related to the above, like the fact that this used to be a compile error: scala> case class Foo() extends Serializable :28: error: trait Serializable is inherited twice case class Foo() extends Serializable ^ It feels like there's a better way to eliminate the duplicate parents, but after spending a lot of time chasing my tail in that peril-fraught zone between namer and typer, I don't see an easy path to improve on it. Closes SI-1799. For that modification to Typers, review by odersky. --- test/files/pos/caseclass-parents.flags | 1 + test/files/pos/caseclass-parents.scala | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 test/files/pos/caseclass-parents.flags create mode 100644 test/files/pos/caseclass-parents.scala (limited to 'test/files/pos') diff --git a/test/files/pos/caseclass-parents.flags b/test/files/pos/caseclass-parents.flags new file mode 100644 index 0000000000..e1b37447c9 --- /dev/null +++ b/test/files/pos/caseclass-parents.flags @@ -0,0 +1 @@ +-Xexperimental \ No newline at end of file diff --git a/test/files/pos/caseclass-parents.scala b/test/files/pos/caseclass-parents.scala new file mode 100644 index 0000000000..d4bc52154b --- /dev/null +++ b/test/files/pos/caseclass-parents.scala @@ -0,0 +1,11 @@ +case class Foo() extends Serializable +case object Bar extends Serializable + +case class Bippy[T, U](x: T, y: U) extends Product2[T, U] { } + +case class Bounded[T <: util.Random, U <: util.Random](x: T, y: U) { } + +class A { + def f(x: Bounded[_, _]) = x.productIterator foreach g + def g(rand: util.Random) = () +} \ No newline at end of file -- cgit v1.2.3