Error codes

E0023: expected a type

In a terminal: auk explain E0023 prints this page.

On this page

A type was expected (after : in a parameter, field or let, or as a return type) and this token can't start one. Types look like int, [str], {str: int}, (int, str), T?, T!, T!E or Set<int>.

Wrong#

auk
fn f(n: 1): int = n

Fixed#

auk
fn f(n: int): int = n

Common causes#

  • A value written where its type belongs: x: 1 instead of x: int.
  • A missing type after :.
  • Syntax from another language: int[] (write [int]), Option<T> (write T?).

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