summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-12-03 23:49:31 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-12-03 23:49:31 -0800
commitf9a3b8206b9235edde322a446fa329f38667306e (patch)
tree794c23753f393e5ba7a8dc3a5c35a8efd941e56c /test
parenta21253f54359b4714eeff986d5c1394b0a46a182 (diff)
parente571c9cc3ee5a9e96b899285cdd2df3cdce06898 (diff)
downloadscala-f9a3b8206b9235edde322a446fa329f38667306e.tar.gz
scala-f9a3b8206b9235edde322a446fa329f38667306e.tar.bz2
scala-f9a3b8206b9235edde322a446fa329f38667306e.zip
Merge pull request #3202 from retronym/topic/function1-tuplen
Diminished Tuple Confusion
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/missing-param-type-tuple.check31
-rw-r--r--test/files/neg/missing-param-type-tuple.scala8
-rw-r--r--test/files/neg/not-a-legal-formal-parameter-tuple.check19
-rw-r--r--test/files/neg/not-a-legal-formal-parameter-tuple.scala5
4 files changed, 63 insertions, 0 deletions
diff --git a/test/files/neg/missing-param-type-tuple.check b/test/files/neg/missing-param-type-tuple.check
new file mode 100644
index 0000000000..bc46ba1023
--- /dev/null
+++ b/test/files/neg/missing-param-type-tuple.check
@@ -0,0 +1,31 @@
+missing-param-type-tuple.scala:3: error: missing parameter type
+Note: The expected type requires a one-argument function accepting a 2-Tuple.
+ Consider a pattern matching anoynmous function, `{ case (a, b) => ... }`
+ val x: ((Int, Int)) => Int = (a, b) => 0
+ ^
+missing-param-type-tuple.scala:3: error: missing parameter type
+ val x: ((Int, Int)) => Int = (a, b) => 0
+ ^
+missing-param-type-tuple.scala:5: error: missing parameter type
+Note: The expected type requires a one-argument function accepting a 3-Tuple.
+ Consider a pattern matching anoynmous function, `{ case (param1, ..., param3) => ... }`
+ val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0
+ ^
+missing-param-type-tuple.scala:5: error: missing parameter type
+ val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0
+ ^
+missing-param-type-tuple.scala:5: error: missing parameter type
+ val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0
+ ^
+missing-param-type-tuple.scala:7: error: missing parameter type
+Note: The expected type requires a one-argument function accepting a 3-Tuple.
+ Consider a pattern matching anoynmous function, `{ case (param1, ..., param3) => ... }`
+ val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0
+ ^
+missing-param-type-tuple.scala:7: error: missing parameter type
+ val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0
+ ^
+missing-param-type-tuple.scala:7: error: missing parameter type
+ val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0
+ ^
+8 errors found
diff --git a/test/files/neg/missing-param-type-tuple.scala b/test/files/neg/missing-param-type-tuple.scala
new file mode 100644
index 0000000000..72c0c82034
--- /dev/null
+++ b/test/files/neg/missing-param-type-tuple.scala
@@ -0,0 +1,8 @@
+class C {
+
+ val x: ((Int, Int)) => Int = (a, b) => 0
+
+ val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0
+
+ val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0
+}
diff --git a/test/files/neg/not-a-legal-formal-parameter-tuple.check b/test/files/neg/not-a-legal-formal-parameter-tuple.check
new file mode 100644
index 0000000000..2b906b8ff3
--- /dev/null
+++ b/test/files/neg/not-a-legal-formal-parameter-tuple.check
@@ -0,0 +1,19 @@
+not-a-legal-formal-parameter-tuple.scala:2: error: not a legal formal parameter.
+Note: Tuples cannot be directly destructured in method or function parameters.
+ Either create a single parameter accepting the Tuple2,
+ or consider a pattern matching anonymous function: `{ case (a, b) => ... }
+ val x: ((Int, Int) => Int) = (((a, b)) => a)
+ ^
+not-a-legal-formal-parameter-tuple.scala:3: error: not a legal formal parameter.
+Note: Tuples cannot be directly destructured in method or function parameters.
+ Either create a single parameter accepting the Tuple2,
+ or consider a pattern matching anonymous function: `{ case (param1, param2) => ... }
+ val y: ((Int, Int, Int) => Int) = (((a, !!)) => a)
+ ^
+not-a-legal-formal-parameter-tuple.scala:4: error: not a legal formal parameter.
+Note: Tuples cannot be directly destructured in method or function parameters.
+ Either create a single parameter accepting the Tuple3,
+ or consider a pattern matching anonymous function: `{ case (param1, ..., param3) => ... }
+ val z: ((Int, Int, Int) => Int) = (((a, NotAPatternVariableName, c)) => a)
+ ^
+three errors found
diff --git a/test/files/neg/not-a-legal-formal-parameter-tuple.scala b/test/files/neg/not-a-legal-formal-parameter-tuple.scala
new file mode 100644
index 0000000000..c7a13557df
--- /dev/null
+++ b/test/files/neg/not-a-legal-formal-parameter-tuple.scala
@@ -0,0 +1,5 @@
+class C {
+ val x: ((Int, Int) => Int) = (((a, b)) => a)
+ val y: ((Int, Int, Int) => Int) = (((a, !!)) => a)
+ val z: ((Int, Int, Int) => Int) = (((a, NotAPatternVariableName, c)) => a)
+}