From 972bf59a65d98286697ca8eed6a80239259808e4 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 28 Feb 2012 16:47:47 +0100 Subject: [vpm] TODO note: make unapply type list stricter when an unapply returns Option[T] where T is some ProductN, does that mean the unapply returns 1 result, i.e., that T, or did it mean to return N results? to disambiguate, falling back to stricter spec-adherence, which requires T be exactly TupleN for N results for now, allow extractor result to be any product, not just tuple --- test/files/run/virtpatmat_extends_product.check | 1 + test/files/run/virtpatmat_extends_product.flags | 1 + test/files/run/virtpatmat_extends_product.scala | 11 +++++++++++ 3 files changed, 13 insertions(+) create mode 100644 test/files/run/virtpatmat_extends_product.check create mode 100644 test/files/run/virtpatmat_extends_product.flags create mode 100644 test/files/run/virtpatmat_extends_product.scala (limited to 'test') diff --git a/test/files/run/virtpatmat_extends_product.check b/test/files/run/virtpatmat_extends_product.check new file mode 100644 index 0000000000..c07e8385a7 --- /dev/null +++ b/test/files/run/virtpatmat_extends_product.check @@ -0,0 +1 @@ +AnnotationInfo(a,1) diff --git a/test/files/run/virtpatmat_extends_product.flags b/test/files/run/virtpatmat_extends_product.flags new file mode 100644 index 0000000000..ac6b805bd0 --- /dev/null +++ b/test/files/run/virtpatmat_extends_product.flags @@ -0,0 +1 @@ +-Yvirtpatmat diff --git a/test/files/run/virtpatmat_extends_product.scala b/test/files/run/virtpatmat_extends_product.scala new file mode 100644 index 0000000000..e564f4430b --- /dev/null +++ b/test/files/run/virtpatmat_extends_product.scala @@ -0,0 +1,11 @@ +object Test extends App { + case class AnnotationInfo(a: String, b: Int) extends Product2[String, Int] + + // if we're not careful in unapplyTypeListFromReturnType, the generated unapply is + // thought to return two components instead of one, since AnnotationInfo (the result of the unapply) is a Product2 + case class NestedAnnotArg(ai: AnnotationInfo) + + NestedAnnotArg(AnnotationInfo("a", 1)) match { + case NestedAnnotArg(x) => println(x) + } +} \ No newline at end of file -- cgit v1.2.3