Skip to content
Playground(another site)

bynk.resolve.param_as_function

Error A value (such as a parameter) was called as a function.

Only a value of function type can be called. n(5) applies n, but n is an Int, so there is nothing to run. It is usually a missing operator or a parameter that was meant to be a function. Give the parameter a function type, such as f: Int -> Int, or drop the call. The check covers any local value, not only parameters.

Example

fn apply(n: Int) -> Int {
n(5) // ✗ `n` is an `Int`, not a function
}
fn apply(f: Int -> Int) -> Int {
f(5) // ✓ a function-typed parameter
}

In the Book

See also

  • The grammar rule it governs: call.
  • Every code in its category, Resolution, on the diagnostic index.
  • bynk explain bynk.resolve.param_as_function shows the same from the installed toolchain, without a network.