Skip to content
Playground(another site)

bynk.resolve.duplicate_const

Error Two constants share a name.

A constant is a value that every use of its name reads, so a name is declared once in a unit. With two Limits, a use would have two values to read. Rename one, or delete the repeat. A constant whose name is a function's, a type's or another declaration's in the unit is bynk.resolve.name_conflict.

Example

const Limit: Int = 1
const Limit: Int = 2 // ✗ `Limit` is already declared
const Cap: Int = 2 // ✓ a different name

In the Book

See also

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