From 68ebbba83b082e9daa715e923c4ce9bc85fa406e Mon Sep 17 00:00:00 2001 From: odersky Date: Tue, 5 Apr 2022 16:19:09 +0200 Subject: [PATCH] Regression test for #4130 Closes #4130 --- tests/pos/i4130.scala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/pos/i4130.scala diff --git a/tests/pos/i4130.scala b/tests/pos/i4130.scala new file mode 100644 index 000000000000..ed4ca879796f --- /dev/null +++ b/tests/pos/i4130.scala @@ -0,0 +1,24 @@ +object Test { + val f: (x: Int) => Int = x => x + + def id[A, B](x: (y: A) => B) = x + + id(f) + // -- [E007] Type Mismatch Error: try/dep.scala:6:5 ------------------------------- + // 6 | id(f) + // | ^ + // | found: (x: Int) => Int(Test.f) + // | required: (y: Nothing) => Any + // | + + id[Int, Int](f) // OK + + trait A + + def foo[E](f: (a: A) => (a.type, E)): E = { + val a = new A {} + f(a)._2 + } + + foo { a => (a, ()) } +} \ No newline at end of file