Skip to content
Playground(another site)

bynk.parse.uses_after_decls

Error uses appears after other declarations.

In the fragment form of a commons or context (the header with no braces), the uses clauses come straight after the header, before any type or fn. Move the uses line up. consumes and exports clauses follow the same rule, as bynk.parse.consumes_after_decls and bynk.parse.exports_after_decls: consumes after the uses lines, exports after the consumes lines.

Example

commons demo
type Id = String
uses util // ✗ a declaration comes first
commons demo
uses util // ✓ clauses straight after the header
type Id = String

In the Book

See also

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