E4025#
方法已为多个类型定义。
错误示例:#
let a = to_string(true)
在上述例子中,试图在布尔值上调用方法 to_string
,但这个方法已经为多个类型定义,因此编译器无法正确推断调用哪个方法,会在第 1 行报错:
Method to_string has been defined for the following types:
<FILE>.mbt:<LINE>:<COLUMN> String
<FILE>.mbt:<LINE>:<COLUMN> Int64
<SNIP>
建议#
通过指定方法的类型来去歧义:
let a = Bool::to_string(true)