Skip to content
Playground(another site)

bynk.types.argument_mismatch

Error A call, method, capability, or constructor argument has the wrong type.

An argument has a different type from the parameter it is passed to. Bynk compares types exactly and converts nothing implicitly, so a String is never read as an Int, and a call that passes the wrong type is refused at the call, not left to fail later. The same code covers the arguments of methods, capability operations and constructors. Pass a value of the parameter's type, or convert it first with an explicit conversion such as Int.parse (which returns an Option, because the text may not be a number).

Example

fn double(n: Int) -> Int {
n * 2
}
fn run() -> Int {
double("21") // ✗ a `String`, where `Int` is expected
}
fn run() -> Int {
double(21) // ✓ an `Int`
}

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.argument_mismatch shows the same from the installed toolchain, without a network.