Skip to content
Playground(another site)

bynk.types.call_arity

Error A function value, a built-in Map/Set/Cell/Cache/Log operation, or unreachable/todo was called with the wrong number of arguments (a declared fn is bynk.resolve.arity_mismatch).

A function value was called with a different number of arguments from the number its type declares. A parameter or local of type (Int, Int) -> Int takes exactly two, and the call is checked against that type, so the mismatch is reported where it is made. The same code covers the built-in operations of Map, Set, Cell, Cache and Log, and unreachable and todo, which each take one message. Pass exactly the declared number. A declared fn called with the wrong number of arguments is the separate code bynk.resolve.arity_mismatch, and a method is bynk.types.method_arity.

Example

fn apply(f: (Int, Int) -> Int) -> Int {
f(1) // ✗ `f` takes 2 arguments
}
fn apply(f: (Int, Int) -> Int) -> Int {
f(1, 2) // ✓
}

In the Book

See also

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