bynk.parse.expected_item
Error Expected a declaration.
A unit's body is a list of declarations, and the parser found something else where the next one should begin. The message lists what this kind of unit accepts (a commons, a context and a suite differ). The commonest cause is code at the top level, which holds declarations only: a let outside any function (a constant is const Name: Type = …) or a call. Others are a misspelt keyword (function, pub fn) and a stray } after a fragment-form unit's last declaration. The position is that token, so look just before it too.
Example
let limit = 100 // ✗ code at the top level of a unitconst Limit: Int = 100 // ✓ a named constantIn the Book
See also
- Every code in its category, Parser, on the diagnostic index.
bynk explain bynk.parse.expected_itemshows the same from the installed toolchain, without a network.