bynk.parse.expected_token
Error Expected a specific token.
The parser was part-way through a construct and the next token had to be one particular token: a ) closing a list, a , between items, a :, =, -> or =>, or a }. The message says which, and what it found instead. The commonest cause is a missing comma: in fn add(a: Int b: Int) it finds b where ) was due. Others are -> for => in a match arm and : for -> before a return type. A missing ) or } is reported at the next token that cannot continue, often on the line below, so read the line above. If the file ended instead, it is bynk.parse.unexpected_eof.
Example
fn add(a: Int b: Int) -> Int { a + b } // ✗ no `,` between the parametersfn add(a: Int, b: Int) -> Int { a + b } // ✓In the Book
- Syntax & grammar › fn_decl
- Test tiers
- Testing › stub — per-seam test doubles
- Testing › Tiers — the as <tier> clause
See also
- Every code in its category, Parser, on the diagnostic index.
bynk explain bynk.parse.expected_tokenshows the same from the installed toolchain, without a network.