XO0405: type cannot be inferred here; annotate it
The checker needs a type at this point and nothing determines it yet: a closure parameter with no expected function type, a value whose method or field is used before its type is known, a match subject, or an iterated value. Add a type annotation to the parameter or binding. See core 3.3.
Example
fn f() -> Int {
let g = fn(p) { p }
g(1)
}Fix
fn f() -> Int {
let g = fn(p: Int) -> Int { p }
g(1)
}Run xo explain XO0405 for this text in a terminal, or see
section 10.6 of the specification.