diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-01-13 12:36:36 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-01-15 11:29:02 +0100 |
commit | 692372ce1d82d0ba41461b9539fdc85238477464 (patch) | |
tree | ca6a4d0435e0db9e12a50c4e0300fda9af42b9f6 /test/files/neg/t6675.scala | |
parent | 9ea0a208346e86031a58fa9c28daf6103778a02f (diff) | |
download | scala-692372ce1d82d0ba41461b9539fdc85238477464.tar.gz scala-692372ce1d82d0ba41461b9539fdc85238477464.tar.bz2 scala-692372ce1d82d0ba41461b9539fdc85238477464.zip |
SI-6675 -Xlint arity enforcement for extractors
Extractor Patterns changed in 2.10.0 to implement
the letter of the spec, which allows a single binding
to capture an entire TupleN. But this can hide arity
mismatches, especially if the case body uses the
bound value as an `Any`.
This change warns when this happens under -Xlint.
Diffstat (limited to 'test/files/neg/t6675.scala')
-rw-r--r-- | test/files/neg/t6675.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/files/neg/t6675.scala b/test/files/neg/t6675.scala new file mode 100644 index 0000000000..4d500b77ba --- /dev/null +++ b/test/files/neg/t6675.scala @@ -0,0 +1,13 @@ +object X { + def unapply(s: String): Option[(Int,Int,Int)] = Some((1,2,3)) +} + +object Y { + def unapplySeq(s: String): Option[Seq[(Int,Int,Int)]] = Some(Seq((1,2,3))) +} + +object Test { + "" match { case X(b) => b } // should warn under -Xlint. Not an error because of SI-6111 + + "" match { case Y(b) => b } // no warning +} |