Skip to content
Playground(another site)

bynk.resolve.let_shadows_fn

Error A let binding shadows a function.

A let may not reuse the name of a function declared in the unit. The name would mean the function in one place and the binding in another, and a reader could not tell which total is meant. Choose a different name for the binding. Reusing a type's name is bynk.resolve.let_shadows_type.

Example

fn total() -> Int { 1 }
fn run() -> Int {
let total = 2 // ✗ shadows the function `total`
total
}
fn run() -> Int {
let sum = total() + 1 // ✓ a new name
sum
}

In the Book

See also

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