Skip to content
Playground(another site)

bynk.resolve.arity_mismatch

Error A function was called with the wrong number of arguments.

A call to a declared fn must pass exactly as many arguments as it has parameters. Bynk has no optional or variadic parameters and fills nothing in, so a missing or extra argument is always a mistake, and the compiler cannot tell which one was meant. Add or remove the argument, or change the declaration. The error points at the call and labels the declaration. A call through a function value or a built-in operation is bynk.types.call_arity, and a method is bynk.types.method_arity.

Example

fn double(x: Int) -> Int {
x * 2
}
fn run(a: Int, b: Int) -> Int {
double(a, b) // ✗ `double` takes one argument
}
fn run(a: Int, b: Int) -> Int {
double(a) + double(b) // ✓ one argument each call
}

In the Book

See also

  • The grammar rule it governs: call.
  • Every code in its category, Resolution, on the diagnostic index.
  • bynk explain bynk.resolve.arity_mismatch shows the same from the installed toolchain, without a network.