The function is overloaded by its first parameter's type, and none of the overloads takes the type given here. The note lists the overloads that exist.
Wrong#
fn describe(n: int): str = "int"
fn describe(s: str): str = "str"
fn main() { print(describe(1.5)) }Fixed#
fn describe(n: int): str = "int"
fn describe(s: str): str = "str"
fn main() { print(describe(int(1.5))) }Common causes#
- A missing conversion of the first argument.
- Arguments passed in the wrong order.
- A new type that needs its own overload: add
fn describe(x: float): str.