summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t0851.check9
-rw-r--r--test/files/neg/t0851.scala25
2 files changed, 34 insertions, 0 deletions
diff --git a/test/files/neg/t0851.check b/test/files/neg/t0851.check
new file mode 100644
index 0000000000..61d2a98632
--- /dev/null
+++ b/test/files/neg/t0851.check
@@ -0,0 +1,9 @@
+t0851.scala:14: error: not enough arguments for method apply: (v1: Int,v2: String)java.lang.String in trait Function2.
+Unspecified value parameter v2.
+ println(f(1))
+ ^
+t0851.scala:22: error: not enough arguments for method apply: (v1: Int,v2: String)java.lang.String in trait Function2.
+Unspecified value parameter v2.
+ println(fn(1))
+ ^
+two errors found
diff --git a/test/files/neg/t0851.scala b/test/files/neg/t0851.scala
new file mode 100644
index 0000000000..b28be2c697
--- /dev/null
+++ b/test/files/neg/t0851.scala
@@ -0,0 +1,25 @@
+package test
+
+// This gives now type errors about missing parameters, which seems OK to me.
+// The tests just make sure it does not crash
+
+object test1 {
+ case class Foo[T,T2](f : (T,T2) => String) extends (((T,T2)) => String){
+ def apply(t : T) = (s:T2) => f(t,s)
+ def apply(p : (T,T2)) = f(p._1,p._2)
+ }
+ implicit def g[T](f : (T,String) => String) = Foo(f)
+ def main(args : Array[String]) : Unit = {
+ val f = (x:Int,s:String) => s + x
+ println(f(1))
+ ()
+ }
+}
+object Main {
+ def main(args : Array[String]) {
+ val fn = (a : Int, str : String) => "a: " + a + ", str: " + str
+ implicit def fx[T](f : (T,String) => String) = (x:T) => f(x,null)
+ println(fn(1))
+ ()
+ }
+}