diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-02-28 16:47:47 +0100 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-03-20 19:53:02 +0100 |
commit | 972bf59a65d98286697ca8eed6a80239259808e4 (patch) | |
tree | 7f85e85fc10db372045970cf1b0d8d3db7eafab3 /test | |
parent | d60099fb5543f92a81605873fea2d14637cbf4c6 (diff) | |
download | scala-972bf59a65d98286697ca8eed6a80239259808e4.tar.gz scala-972bf59a65d98286697ca8eed6a80239259808e4.tar.bz2 scala-972bf59a65d98286697ca8eed6a80239259808e4.zip |
[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
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/virtpatmat_extends_product.check | 1 | ||||
-rw-r--r-- | test/files/run/virtpatmat_extends_product.flags | 1 | ||||
-rw-r--r-- | test/files/run/virtpatmat_extends_product.scala | 11 |
3 files changed, 13 insertions, 0 deletions
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 |