v0.13.7
errors and warnings / types

errors and warnings / types / E2060

E2060 error

A local after an annotated one is named after a type (local a, b: T, U: the annotations go on each name, local a: T, b: U)

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

In local a, b: T, U, the annotation belongs to b only, so U is read as a third local named after a type. Annotate each name on its own: local a: T, b: U.

Example

× failswowlua
local x, y: number, number = 1, 2print(x, y)
✓ compileswowlua
local x: number, y: number = 1, 2print(x, y)

The compiler reports it like this:

error[E2060]: `number` is declared as a local, but it names a type: annotate each name (`local a: T, b: U`)
  ┌─ src/main.wowlua:1:21
  │
1 │ local x, y: number, number = 1, 2
  │                     ^^^^^^ here
codemessage
E2001Type mismatch: S is not assignable to T

Offline

terminal
$ wowlua explain E2060
E2060 (error): A local after an annotated one is named after a type (local a, b: T, U: the annotations go on each name, local a: T, b: U)

source on GitHub ↗