Skip to content
Playground(another site)

bynk.uses.name_conflict

Error Two commons a unit uses declare the same type, function, constant, asset or embed; or a value crosses between a unit's code and an imported declaration's position whose type the unit shadows; or a reference names an import the unit's own declaration shadows.

A unit that uses a commons gets what it declares (types, functions, constants, assets and embeds) in scope under their own names, with no prefix. If two commons it uses both declare the same name, a mention of it could mean either, so the compiler refuses the second uses. uses has no as rename yet. Rename one of the declarations, drop one of the uses, or mark the declaration private if only its own commons needs it, since a private declaration is never imported and so never conflicts.

Example

billing.bynk
commons billing
type Amount = Int where Positive
// shipping.bynk
commons shipping
type Amount = Int where NonNegative // both declare `Amount`
type Postage = Int where NonNegative // ✓ renamed
// orders.bynk
commons orders
uses billing
uses shipping // ✗ `Amount` is also declared by `billing`

In the Book

See also

  • The grammar rule it governs: uses_decl.
  • Every code in its category, Uses, on the diagnostic index.
  • bynk explain bynk.uses.name_conflict shows the same from the installed toolchain, without a network.