summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala4
-rw-r--r--test/files/neg/t6675.flags2
-rw-r--r--test/files/neg/t6675b.flags2
-rw-r--r--test/files/pos/t6675.flags2
-rw-r--r--test/files/run/t6111.check1
-rw-r--r--test/files/run/t6111.scala2
6 files changed, 8 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala b/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala
index 7858cb5586..d10eff1d8d 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/ScalacPatternExpanders.scala
@@ -139,8 +139,8 @@ trait ScalacPatternExpanders {
def acceptMessage = if (extractor.isErroneous) "" else s" to hold ${extractor.offeringString}"
val requiresTupling = isUnapply && patterns.totalArity == 1 && productArity > 1
- if (settings.lint && requiresTupling && effectivePatternArity(args) == 1)
- currentUnit.warning(sel.pos, s"${sel.symbol.owner} expects $productArity patterns$acceptMessage but crushing into $productArity-tuple to fit single pattern (SI-6675)")
+ if (requiresTupling && effectivePatternArity(args) == 1)
+ currentUnit.deprecationWarning(sel.pos, s"${sel.symbol.owner} expects $productArity patterns$acceptMessage but crushing into $productArity-tuple to fit single pattern (SI-6675)")
val normalizedExtractor = if (requiresTupling) tupleExtractor(extractor) else extractor
validateAligned(fn, Aligned(patterns, normalizedExtractor))
diff --git a/test/files/neg/t6675.flags b/test/files/neg/t6675.flags
index e93641e931..2843ea9efc 100644
--- a/test/files/neg/t6675.flags
+++ b/test/files/neg/t6675.flags
@@ -1 +1 @@
--Xlint -Xfatal-warnings \ No newline at end of file
+-deprecation -Xlint -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t6675b.flags b/test/files/neg/t6675b.flags
index 1008b0a70c..2fcfa0cddb 100644
--- a/test/files/neg/t6675b.flags
+++ b/test/files/neg/t6675b.flags
@@ -1 +1 @@
--Xlint
+-deprecation -Xlint
diff --git a/test/files/pos/t6675.flags b/test/files/pos/t6675.flags
index e8fb65d50c..d1b831ea87 100644
--- a/test/files/pos/t6675.flags
+++ b/test/files/pos/t6675.flags
@@ -1 +1 @@
--Xfatal-warnings \ No newline at end of file
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/run/t6111.check b/test/files/run/t6111.check
index 7fd2e33526..1f23a87f73 100644
--- a/test/files/run/t6111.check
+++ b/test/files/run/t6111.check
@@ -1,2 +1,3 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
(8,8)
(x,x)
diff --git a/test/files/run/t6111.scala b/test/files/run/t6111.scala
index 7cceea1d09..c0bcf17a07 100644
--- a/test/files/run/t6111.scala
+++ b/test/files/run/t6111.scala
@@ -1,3 +1,5 @@
+// SI-6675 DEPRECATED AUTO-TUPLING BECAUSE BAD IDEA -- MEAMAXIMACULPA
+// TODO: remove this test case in 2.12, when the deprecation will go into effect and this will no longer compile
// slightly overkill, but a good test case for implicit resolution in extractor calls,
// along with the real fix: an extractor pattern with 1 sub-pattern should type check for all extractors
// that return Option[T], whatever T (even if it's a tuple)