Skip to content
Playground(another site)

bynk.resolve.duplicate_fn

Error Two functions share a name.

A function is called by its name, and Bynk has no overloading: two functions of one name in a unit, even with different parameters, would leave a call unable to say which it means. So a unit declares each function name once. Rename one of them. A suite's helpers repeat as bynk.suite.duplicate_fn, and a type's methods as bynk.resolve.duplicate_method.

Example

fn total(a: Int, b: Int) -> Int { … }
fn total(a: Int, b: Int, c: Int) -> Int { … } // ✗ `total` is already declared
fn total3(a: Int, b: Int, c: Int) -> Int { … } // ✓

In the Book

See also

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