XO0402: type arguments cannot be inferred
A generic function’s type parameter was determined by nothing: not the arguments, the expected type, or later use. Write the type argument explicitly (json.decode[Int](b)), or give the result an expected type. See core 2.7.
Example
use std/json
fn f(b: Bytes) -> Int {
let _ = json.decode(b).ok()
1
}Fix
use std/json
fn f(b: Bytes) -> Int {
let _ = json.decode[Int](b).ok()
1
}Run xo explain XO0402 for this text in a terminal, or see
section 10.6 of the specification.