Error codes

E0111: function defined twice (non-contiguous clauses or duplicate overload)

In a terminal: auk explain E0111 prints this page.

On this page

Two functions have the same name, the same number of parameters and the same first-parameter type. Clauses of one function must be contiguous, and overloads must differ in the number of parameters or the type of the first one.

Wrong#

auk
fn size(x: int): int = 1
fn other(): int = 0
fn size(y: int): int = 2

Fixed#

auk
fn size(x: int): int = 1
fn size(y: str): int = 2
fn other(): int = 0

Common causes#

  • Clauses of one function split by another function: keep them together.
  • A function pasted twice.
  • Overloads that differ only in a later parameter: make the first parameter differ, or rename.

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