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#
fn size(x: int): int = 1
fn other(): int = 0
fn size(y: int): int = 2Fixed#
fn size(x: int): int = 1
fn size(y: str): int = 2
fn other(): int = 0Common 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.