我有隐式转换和高阶函数的问题.似乎只有转换函数至少有两个参数,函数到二阶函数的隐式转换才有效.
作品:
implicit def conv(foo: Integer => String): String => String = null
Run Code Online (Sandbox Code Playgroud)
不起作用:
implicit def conv(foo: Integer => String): String => String => String = null
Run Code Online (Sandbox Code Playgroud)
作品:
implicit def conv(foo: (Integer, Integer) => String): String => String => String = null
Run Code Online (Sandbox Code Playgroud)
完整的失败点示例:
{
implicit def conv(foo: Integer => String): String => String = null
def baadf00d(foo: Integer): String = null
def deadbeef(foo: String => String) = null
deadbeef(conv(baadf00d))
deadbeef(baadf00d)
}
{
implicit def conv(foo: Integer => String): String => …Run Code Online (Sandbox Code Playgroud)