Skip to content
Playground(another site)

bynk.types.method_arity

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

A method was called with a different number of arguments from the number it declares. The count excludes self, which the receiver supplies, so fn Box.adjust(self, delta: Int) takes one argument. Pass exactly that many. The same code covers the built-in methods of String, List, Map and the other kernel types.

Example

type Box = { value: Int }
fn Box.adjust(self, delta: Int) -> Box {
Box { value: self.value + delta }
}
fn bump(b: Box) -> Box {
b.adjust() // ✗ expects 1 argument
}
fn bump(b: Box) -> Box {
b.adjust(1) // ✓
}

In the Book

See also

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