Skip to content
Playground(another site)

bynk.parse.generic_arg_count

Error Wrong number of generic type arguments.

Result takes two type arguments, the success type and the error type: Result[T, E]. Map takes two as well, Map[K, V], and a type applied to an empty [] needs at least one. A Result[Int] leaves out the error a caller has to handle, so it is refused rather than guessed. Give every argument.

Example

fn parse(s: String) -> Result[Int] { // ✗ the error type is missing
Ok(1)
}
fn parse(s: String) -> Result[Int, String] { // ✓
Ok(1)
}

In the Book

See also

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