让
def h(a: AnyRef*) = a.mkString(",")
h: (a: AnyRef*)String
Run Code Online (Sandbox Code Playgroud)
所以
h("1","2")
res: String = 1,2
Run Code Online (Sandbox Code Playgroud)
然而, h(1,2)
error: the result type of an implicit conversion must be more specific than AnyRef
h(1,2)
^
error: the result type of an implicit conversion must be more specific than AnyRef
h(1,2)
^
Run Code Online (Sandbox Code Playgroud)
这至少在Scala 2.11.1和2.11.1中.询问解决方法.
scala ×1