-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
In the following example I compose int
with int
.
object Test {
def int[A](k: String => A)(s: String)(x: Int): A = ???
// composing directly: ok in scalac, error in dotc
val c: (String => String) => (String) => (Int) => (Int) => String = (int[Int => String] _).compose(int[String] _)
// unwrapping composition: ok in scalac, ok in dotc
val q: (String => Int => String) => (String) => (Int) => (Int => String) = int[Int => String]
val p: (String => String) => (String) => (Int) => String = int[String]
val c2: (String => String) => (String) => (Int) => (Int) => String = q.compose(p)
}
Doing it directly raises an inference error for both parameters of the anonymous function in dotty with the following error:
error missing parameter type
The argument types of an anonymous function must be fully known. (SLS 8.5)
Expected type: class dotty.tools.dotc.typer.ProtoTypes$AnyFunctionProto$
Missing type for parameter s