E4080#
参数数量不匹配:提供的参数数量不正确。
错误示例#
函数参数数量不匹配:
///|
fn f(x : Int, y : Double) -> Unit {
ignore((x, y))
}
///|
test {
f(0) // Error: This function has type (Int, Double) -> Unit, which requires 2 arguments, but is given 1 argument.
}
构造函数参数数量不匹配:
///|
priv enum E {
A(Int, Double, String)
}
///|
test {
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 f(x : Int, y : Double) -> Unit {
ignore((x, y))
}
///|
test {
f(0, 1.0)
}
构造函数参数数量不匹配:
///|
priv enum E {
A(Int, Double, String)
}
///|
test {
match A(0, 1.0, "foo") {
A(x, y, z) => ignore((x, y, z))
}
}