v0.13.7
errors and warnings / types

errors and warnings / types / E2056

E2056 error

Type pack used in an invalid position

area
types (x2xxx)
fails the build
yes
in plain Lua files
reported as W2056

A type pack (T..., a generic pack parameter) is used where only a single type can stand. A pack belongs in a function type's parameters or results, as a type argument for a pack parameter, or as the expansion ...: T....

Example

× failswowlua
local function first<T...>(...: T...): T    return (...)endprint(first(1, 2))
✓ compileswowlua
local function all<T...>(...: T...): T...    return ...endprint(all(1, 2))

The compiler reports it like this:

error[E2056]: `T` is a type pack, which stands for several types: write `T...` in a parameter or result list, or `...: T...`
  ┌─ src/main.wowlua:1:40
  │
1 │ local function first<T...>(...: T...): T
  │                                        ^ a single type is expected here

Offline

terminal
$ wowlua explain E2056
E2056 (error): Type pack used in an invalid position

source on GitHub ↗