E4013

E4013#

This function has a type which expects a different number of arguments than provided.

Erroneous Example#

fn f() -> (() -> Int) {
  fn (x: Int) { x }
}

The example above declares a function f returns a function which expects no arguments, but returns a function that expects one argument. This will give the following error on line 2:

This function has type () -> Int, which expects 0 argument(s), but is given 1 argument(s).

Suggestion#

Adjust the code so that the number of arguments in the function type matches the number of arguments in the function definition:

///|
pub fn () -> () ->  {
  fn( : ) {  }
}

… or:

///|
pub fn ( : ) -> () ->  {
  fn() {  }
}