E4080

E4080#

Arity mismatch: incorrect number of arguments provided.

Erroneous example#

Function arity mismatch:

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

Constructor arity mismatch:

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

Suggestion#

Provide the correct number of arguments.

Function arity mismatch:

///|
fn ( : ,  : ) ->  {
  ((, ))
}

///|
test {
  (0, 1.0)
}

Constructor arity mismatch:

///|
priv enum  {
  (, , )
}

///|
test {
  match (0, 1.0, "foo") {
    (, , ) => ((, , ))
  }
}