summaryrefslogtreecommitdiff
path: root/test/files/neg/t6214.check
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan@lightbend.com>2016-07-27 11:18:08 -0700
committerAdriaan Moors <adriaan@lightbend.com>2016-08-12 16:39:31 -0700
commit228d1b1ceb7643df1313672cd620cddb1a429029 (patch)
tree4fb946f9fe8a03cf759f194b94e17c8544bbd4fb /test/files/neg/t6214.check
parent618d42c747955a43557655bdc0c4281fec5a7923 (diff)
downloadscala-228d1b1ceb7643df1313672cd620cddb1a429029.tar.gz
scala-228d1b1ceb7643df1313672cd620cddb1a429029.tar.bz2
scala-228d1b1ceb7643df1313672cd620cddb1a429029.zip
Propagate overloaded function type to expected arg type
Infer missing parameter types for function literals passed to higher-order overloaded methods by deriving the expected argument type from the function types in the overloaded method type's argument types. This eases the pain caused by methods becoming overloaded because SAM types and function types are compatible, which used to disable parameter type inference because for overload resolution arguments are typed without expected type, while typedFunction needs the expected type to infer missing parameter types for function literals. It also aligns us with dotty. The special case for function literals seems reasonable, as it has precedent, and it just enables the special case in typing function literals (derive the param types from the expected type). Since this does change type inference, you can opt out using the Scala 2.11 source level. Fix scala/scala-dev#157
Diffstat (limited to 'test/files/neg/t6214.check')
-rw-r--r--test/files/neg/t6214.check7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/files/neg/t6214.check b/test/files/neg/t6214.check
index 6349a3e71c..9d746351d1 100644
--- a/test/files/neg/t6214.check
+++ b/test/files/neg/t6214.check
@@ -1,4 +1,7 @@
-t6214.scala:5: error: missing parameter type
+t6214.scala:5: error: ambiguous reference to overloaded definition,
+both method m in object Test of type (f: Int => Unit)Int
+and method m in object Test of type (f: String => Unit)Int
+match argument types (Any => Unit)
m { s => case class Foo() }
- ^
+ ^
one error found