v0.13.7
errors and warnings / classes

errors and warnings / classes / E3044

E3044 error

Overload implementation does not accept every overload signature

area
classes (x3xxx)
fails the build
yes

The implementation after overload function signatures doesn't accept one of them: an argument that overload takes doesn't fit the implementation's parameters, or the results don't fit either way. Callers only see the overloads, so the implementation must handle all of them. Widen the implementation's parameters, often to a union.

Example

× failswowlua
overload function size(s: string): numberoverload function size(t: table): numberlocal function size(v: string): number    return #vendprint(size("a"))
✓ compileswowlua
overload function size(s: string): numberoverload function size(t: table): numberlocal function size(v: string | table): number    return #vendprint(size("a"))

The compiler reports it like this:

error[E3044]: the implementation of `size` (`(v: string) -> number`) does not accept this overload (`(t: table) -> number`)
  ┌─ src/main.wowlua:2:19
  │
2 │ overload function size(t: table): number
  │                   ^^^^ here
codemessage
E3047overload function signature not followed by its implementation
E2012No overload matches the call

Offline

terminal
$ wowlua explain E3044
E3044 (error): Overload implementation does not accept every overload signature

source on GitHub ↗