diff options
author | Martin Odersky <odersky@gmail.com> | 2015-10-31 12:58:01 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-02-16 15:23:43 +0100 |
commit | 29104c9755a9d6393959a416650422b84f0957f2 (patch) | |
tree | 19f844e71f9904c19714f4cab8c93fffc97db437 /tests/neg | |
parent | 5e8023335e641c9c05c6517a82764571e7ef6386 (diff) | |
download | dotty-29104c9755a9d6393959a416650422b84f0957f2.tar.gz dotty-29104c9755a9d6393959a416650422b84f0957f2.tar.bz2 dotty-29104c9755a9d6393959a416650422b84f0957f2.zip |
Auto-uncurry n-ary functions.
Implements SIP #897.
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/function-arity.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/neg/function-arity.scala b/tests/neg/function-arity.scala new file mode 100644 index 000000000..83aa94482 --- /dev/null +++ b/tests/neg/function-arity.scala @@ -0,0 +1,22 @@ +object Test { + + // From #873: + + trait X extends Function1[Int, String] + implicit def f2x(f: Function1[Int, String]): X = ??? + ({case _ if "".isEmpty => 0} : X) // error: expected String, found Int + + // Tests where parameter list cannot be made into a pattern + + def unary[T](x: T => Unit) = ??? + unary((x, y) => ()) // error + + unary[(Int, Int)]((x, y) => ()) + + unary[(Int, Int)](() => ()) // error + unary[(Int, Int)]((x, y, _) => ()) // error + + unary[(Int, Int)]((x: String, y) => ()) // error + + +} |