Skip to content

Commit cc7ae5e

Browse files
authored
Merge pull request #14854 from dotty-staging/fix-4130
Regression test for #4130
2 parents 97c910a + 68ebbba commit cc7ae5e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/pos/i4130.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
object Test {
2+
val f: (x: Int) => Int = x => x
3+
4+
def id[A, B](x: (y: A) => B) = x
5+
6+
id(f)
7+
// -- [E007] Type Mismatch Error: try/dep.scala:6:5 -------------------------------
8+
// 6 | id(f)
9+
// | ^
10+
// | found: (x: Int) => Int(Test.f)
11+
// | required: (y: Nothing) => Any
12+
// |
13+
14+
id[Int, Int](f) // OK
15+
16+
trait A
17+
18+
def foo[E](f: (a: A) => (a.type, E)): E = {
19+
val a = new A {}
20+
f(a)._2
21+
}
22+
23+
foo { a => (a, ()) }
24+
}

0 commit comments

Comments
 (0)