Skip to content
Playground(another site)

bynk.uses.self_reference

Error A commons uses itself.

uses brings another commons into scope. A commons' own declarations are already there, so using itself adds nothing, and a unit that depends on itself is a cycle of length one. Delete the clause, or, if you meant another commons, name it. The mirror of this for contexts is bynk.consumes.self_reference.

Example

tax.bynk
commons tax
fn rate() -> Int { 20 }
// money.bynk
commons money
uses money // ✗ a commons cannot use itself
uses tax // ✓ a different commons
type Amount = Int where NonNegative

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.self_reference shows the same from the installed toolchain, without a network.