Skip to content
TE111 · Type · error

Method call argument type mismatch

An argument's type does not match the corresponding parameter's declared type.

Why this fires

An argument's type does not match the parameter it is being passed to. The argument count is right — only the type is wrong:

fn area(width: float, height: float) -> float {
    return width * height
}

area("10", 5.0)
//   ^^^^ error: argument 1 has type `str`, expected `float`

The compiler walks parameters left-to-right and surfaces the first mismatch, but in error-recovery mode it tries to keep going so you may see several TE111 for a single call.

Fix it

1. Convert the argument

area(tonumber("10") ?? 0.0, 5.0)

2. Change the parameter type

If the function should accept a wider type, generalise it:

fn area(width: float, height: float) -> float { ... }

// becomes

fn area<T: Num>(width: T, height: T) -> T { ... }

3. Provide an overload via traits or pattern matching

For polymorphic input, accept an enum / trait at the boundary and dispatch inside:

enum Length { Px(float), Cm(float) }

fn area(width: Length, height: Length) -> float { ... }

See also

  • TE110 — the argument count is wrong.
  • TE001 — a similar mismatch on a let annotation rather than a parameter.
enespt-br