Skip to content
Playground(another site)

bynk.parse.const_missing_type

Error A const declaration has no type annotation; a constant's type is always written (const Name: Type = …).

A const always states its type: const Limit: Int = 100. A constant is part of its unit's interface, so a reader, or a unit that uses it, can see its type without inferring it from the initialiser. Write the type after the name, before the =.

Example

const Limit = 100 // ✗ no type annotation
const Limit: Int = 100 // ✓

In the Book

See also

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