Skip to content
Playground(another site)

bynk.consumes.name_conflict

Error A consumes name collides with another name in scope.

consumes payment brings every type that payment exports into scope under its own name, because the services' signatures use them. If this context already has something of that name, a type declared here or reached through uses, or a function, asset, service, agent or provider, a mention would mean two things, so the compiler refuses the clause. Rename the imported type with as: it is then in scope only under the alias, and is still the same type. bynk.consumes.type_alias_conflict is the same clash with an alias.

Example

payment.bynk
context payment
exports transparent { Amount }
// money.bynk
commons money
type Amount = Int where NonNegative
// orders.bynk
context orders
uses money
consumes payment // ✗ `Amount` is also in scope from `money`
consumes payment { Amount as PayAmount } // ✓ `PayAmount` is `payment`'s

In the Book

See also

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