bynk.resolve.let_shadows_type
Error A let binding shadows a type.
A let may not take the name of a declared type. The same name would then mean a type in one position and a value in another within one body, which is hard to read and easy to get wrong. Choose a different name for the binding, conventionally in lower case. Reusing a function's name is bynk.resolve.let_shadows_fn.
Example
type Reps = Int where InRange(1, 100)
fn run(n: Int) -> Int { let Reps = n // ✗ shadows the type `Reps` n}
fn run(n: Int) -> Int { let reps = n // ✓ a new name reps}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_typeshows the same from the installed toolchain, without a network.