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
overload function size(s: string): numberoverload function size(t: table): numberlocal function size(v: string): number return #vendprint(size("a"))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
Related codes
| code | message |
|---|---|
| E3047 | overload function signature not followed by its implementation |
| E2012 | No overload matches the call |
Offline
$ wowlua explain E3044 E3044 (error): Overload implementation does not accept every overload signature