bynk.types.cannot_infer_option_type_param
Error The value type of None could not be inferred.
None carries no value, so its Option[T] takes T from where it is used: an annotation, a parameter, or the function's return type. A let of a bare None has none, and the compiler will not guess, because T becomes part of everything the binding touches. Annotate it, as in let missing: Option[Int] = None, or use None where an Option is expected.
Example
fn run() -> Int { let missing = None // ✗ an `Option` of what? 1}
fn run() -> Int { let missing: Option[Int] = None // ✓ 1}In the Book
See also
- The grammar rule it governs:
none_expr. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.cannot_infer_option_type_paramshows the same from the installed toolchain, without a network.