E4013

E4013#

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

错误示例:#

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).

建议#

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

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

或:

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