aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/function-arity.scala
blob: 83aa9448276ef4a12c2b9a365e83c41c5104764b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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


}