From b80b179d6fbb92c8f6ff3616cec1f3aab5106799 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 30 Oct 2015 19:11:19 +0100 Subject: Also handle SAM functions when adaptiing arity of case lambdas. --- tests/pos/i873.scala | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/pos') diff --git a/tests/pos/i873.scala b/tests/pos/i873.scala index 71c8a3959..94f8d2c67 100644 --- a/tests/pos/i873.scala +++ b/tests/pos/i873.scala @@ -1,4 +1,10 @@ object Test { def call(k: (Int, Int) => Unit): Unit = ??? def test = call({ case (x, y) => ()}) + + trait X extends Function1[Int, String] + implicit def f2x(f: Function1[Int, String]): X = ??? + ({case _ if "".isEmpty => ""} : X) // allowed, implicit view used to adapt + + // ({case _ if "".isEmpty => 0} : X) // expected String, found Int } -- cgit v1.2.3