summaryrefslogtreecommitdiff
path: root/test/files/neg/t6258.check
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-08-19 18:25:35 +0200
committerJason Zaugg <jzaugg@gmail.com>2012-08-23 21:41:31 +0200
commitd614ae6e76249ab746a3e78af6e216301ba9bdb4 (patch)
tree48134ee60e9833a82dcde2b6a725e629bec0a428 /test/files/neg/t6258.check
parent1ab4994990a21c1ea4dadcf15368013d89456ca6 (diff)
downloadscala-d614ae6e76249ab746a3e78af6e216301ba9bdb4.tar.gz
scala-d614ae6e76249ab746a3e78af6e216301ba9bdb4.tar.bz2
scala-d614ae6e76249ab746a3e78af6e216301ba9bdb4.zip
SI-6258 Reject partial funs with undefined param types
This regressed with virtpatmat. With -Xoldpatmat, pattern matching anonymous functions with an expected type of PartialFunction[A, B] are translated to a Function tree, and typed by typedFunction, which issues an error of the parameter types are not fully defined. This commit adds the same check to MatchFunTyper. It doesn't plug the hole in RefChecks#validateVariance (which is reminiscent of SI-3577.) Seems to me that in general one should handle: a) both BoundedWildcardType and WildcardType when in a place that can be called during inference, or b) neither otherwise
Diffstat (limited to 'test/files/neg/t6258.check')
-rw-r--r--test/files/neg/t6258.check16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/files/neg/t6258.check b/test/files/neg/t6258.check
new file mode 100644
index 0000000000..73363d8280
--- /dev/null
+++ b/test/files/neg/t6258.check
@@ -0,0 +1,16 @@
+t6258.scala:2: error: missing parameter type for expanded function
+The argument types of an anonymous function must be fully known. (SLS 8.5)
+Expected type was: PartialFunction[?, Int]
+ val f : PartialFunction[_, Int] = { case a : Int => a } // undefined param
+ ^
+t6258.scala:5: error: missing parameter type for expanded function
+The argument types of an anonymous function must be fully known. (SLS 8.5)
+Expected type was: PartialFunction[?,Int]
+ foo { case a : Int => a } // undefined param
+ ^
+t6258.scala:22: error: missing parameter type for expanded function
+The argument types of an anonymous function must be fully known. (SLS 8.5)
+Expected type was: PartialFunction[?,Any]
+ bar[M[Any]] (foo { // undefined param
+ ^
+three errors found