The clauses of one function are tried top to bottom, so each parameter must have the same type in every clause. Here one clause declares a parameter with a different type than an earlier one.
Wrong#
fn label(0, s: str): str = "zero"
fn label(n: int, s: int): str = "many"Fixed#
fn label(0, s: str): str = "zero"
fn label(n: int, s: str): str = "many {s}"Common causes#
- A typo in one clause's annotation.
- Two different functions that happen to share a name: give them different names, or put the differing type first (overloads differ by their first parameter's type).