You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@paulp said:
Please search for existing tickets before opening new ones. Already fixed in trunk. However all is not lost, I used this ticket as motivation to backport those two commits for 2.9.2.
scala> def k( j : (Int => Int) => Int ) : Int = j(_+1)
k: (j: (Int => Int) => Int)Int
scala> def p(q : Int => Int) : Int = q(0)
p: (q: Int => Int)Int
scala> def z = (x : Int) => (y : Int) => x + y
z: Int => (Int => Int)
scala> k(p)
res0: Int = 1
scala> k(z)
<console>:10: error: type mismatch;
found : Int => (Int => Int)
required: (Int => Int) => Int
k(z)
^
Scala's compiler prints several types ambiguously.
For example:
This can produce some confusing type errors such as
scala> k(z)
<console>:10: error: type mismatch;
found : Int => Int => Int
required: Int => Int => Int
Or
scala> h(g)
<console>:10: error: type mismatch;
found : (Int, Int) => Int
required: (Int, Int) => Int
Here's a gist of how to set up these particular type errors: https://gist.github.com/1655807
The text was updated successfully, but these errors were encountered: