Error codes

E0360: type can't be inferred

In a terminal: auk explain E0360 prints this page.

On this page

Nothing in the code says what type this value has, typically an empty list [] or map {} that is never used in a way that fixes its element type. Add a type annotation.

Wrong#

auk
fn main() {
  let xs = []
  print(xs.len())
}

Fixed#

auk
fn main() {
  let xs: [int] = []
  print(xs.len())
}

Common causes#

  • An empty collection literal with no annotation.
  • none with nothing that says what it's missing.
  • Type arguments are never written at call sites: annotate the variable instead (let ts: [Todo] = json.decode(s)?).

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page