Sisu
E0053

Call with the wrong number of arguments

Error

Built from the repository at commit a8614dc.

A call passes one argument for each parameter of the function or method, and a variant's constructor one for each field of its payload: Expr.Num(1). The array methods len() and sum() take none and contains(x) takes one; a conversion i64(...) or u8(...) takes one, and so do panic(...) and todo(...); read_line() takes none.

Why

Sisu has no default values for parameters and no functions that take a varying number of arguments. Each parameter needs its value, and a value with no parameter has nowhere to go.

Broken

fn add(a: i64, b: i64) -> i64 {
    a + b
}

fn main() {
    print(add(1))
}

What sisu says

error[E0053]: `add` takes 2 arguments, found 1
 --> E0053.sisu:6:11
  |
6 |     print(add(1))
  |           ^^^^^^

sisu: 1 error
sisu: for more on a code, run `sisu explain <code>`: E0053

Fixed

fn add(a: i64, b: i64) -> i64 {
    a + b
}

fn main() {
    print(add(1, 2))
}

Related

  • E0064: a constructor with more arguments than the class or variant has fields.