Closed
Description
Compiler version
3.5.0-RC1
Minimized code
import scala.language.experimental.namedTuples
val m: (foo: String => Int, bar: String => Int) = (foo = _.length, bar = _.length) // error // error
val n: (String => Int, String => Int) = (_.length, _.length)
Output
[error] foo.scala:30:60
[error] Missing parameter type
[error]
[error] I could not infer the type of the parameter _$5
[error] in expanded function:
[error] _$5 => _$5.length
[error] Expected type for the whole anonymous function:
[error] Any
[error] val m: (foo: String => Int, bar: String => Int) = (foo = _.length, bar = _.length)
[error] ^
[error] foo.scala:30:76
[error] Missing parameter type
[error]
[error] I could not infer the type of the parameter _$6
[error] in expanded function:
[error] _$6 => _$6.length
[error] Expected type for the whole anonymous function:
[error] Any
[error] val m: (foo: String => Int, bar: String => Int) = (foo = _.length, bar = _.length)
[error] ^
Expectation
correctly infer the arguments, as with normal tuples.
Use Case
I would like to be able to construct programatically a type for a named tuple where all its fields are function types, and then the user should be able to construct this object without explicit parameter types