Skip to content
Playground(another site)

bynk.resolve.fn_without_call

Error A function was referenced without being called.

A function's name on its own is the function, not its result. It is a value only where a function type is expected, such as an argument to map; anywhere else it is nearly always a forgotten call. Call it with its arguments, or pass it where a function is wanted.

Example

fn double(x: Int) -> Int { x * 2 }
fn run() -> Int {
let d = double // ✗ the function itself, not a call
5
}
fn run() -> Int {
let d = double(5) // ✓ the result of calling it
d
}

In the Book

See also

  • Every code in its category, Resolution, on the diagnostic index.
  • bynk explain bynk.resolve.fn_without_call shows the same from the installed toolchain, without a network.