Skip to content
Playground(another site)

bynk.parse.expected_type

Error Expected a type.

A type was expected here, and the next token cannot start one. The message says which position wanted it (as the return type, as the parameter type). The commonest cause is a type left out: a -> with nothing before the {, or a : with nothing after it. A trailing comma in a type-argument list (Map[String, ]) and a value where a type belongs (n: 5) land here too. The position is the token after the gap, so look just before it.

Example

fn double(n: Int) -> { // ✗ no return type after `->`
n * 2
}
fn double(n: Int) -> Int { // ✓
n * 2
}

In the Book

See also

  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.expected_type shows the same from the installed toolchain, without a network.