E4080#
参数数不匹配:提供的参数数不正确。
错误示例#
函数形状不匹配:
fn f(x : Int, y : Double) -> Unit {
ignore((x, y))
}
fn main {
f(0) // Error: This function has type (Int, Double) -> Unit, which requires 2 arguments, but is given 1 argument.
}
构造函数形状不匹配:
enum E {
A(Int, Double, String)
}
fn main {
match A(0, 1.0) { // Error: This function has type (Int, Double, String) -> E, which requires 3 arguments, but is given 2 arguments.
A(_, _) => ... // Error: The constructor A requires 3 arguments, but is given 2 arguments.
}
}
建议#
提供正确数量的参数。
函数形状不匹配:
fn main {
f(0, 1.0)
}
构造函数形状不匹配:
fn main {
match A(0, 1.0, "foo") {
A(_, _, _) => ...
}
}