E4080

E4080#

Arity mismatch: incorrect number of arguments provided.

错误示例#

Function arity mismatch:

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.
}

Constructor arity mismatch:

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.
  }
}

建议#

Provide the correct number of arguments.

Function arity mismatch:

fn main {
  f(0, 1.0)
}

Constructor arity mismatch:

fn main {
  match A(0, 1.0, "foo") {
    A(_, _, _) => ...
  }
}