errors and warnings / names / E1020
E1020 error
Reference to a declaration removed by @if or static elimination
- area
- names (x1xxx)
- fails the build
- yes
- in plain Lua files
- reported as W1020
Code that is kept in this build uses a declaration that @if (or static
elimination) removed from it, for example a flavor-only function called
without a check. In game the name would be nil. Guard the use with the
same static condition (if flavor == "standard" then … end, which is
removed with it), or remove the @if.
Example
import flavor from "wowlua:meta" @if(flavor == "standard")local function setupEditMode() print("edit mode")end setupEditMode()import flavor from "wowlua:meta" @if(flavor == "standard")local function setupEditMode() print("edit mode")end if flavor == "standard" then setupEditMode()endThe compiler reports it like this:
error[E1020]: `setupEditMode` was removed by `@if` for this build ┌─ src/main.wowlua:8:1 │ 3 │ ╭ @if(flavor == "standard") 4 │ │ local function setupEditMode() 5 │ │ print("edit mode") 6 │ │ end │ ╰───' removed here 7 │ 8 │ setupEditMode() │ ^^^^^^^^^^^^^ used here
Related codes
| code | message |
|---|---|
| E1040 | @if condition is not a static condition |
| E1039 | @if(flavor …) in a .wowlua file in shared flavor mode |
Offline
$ wowlua explain E1020 E1020 (error): Reference to a declaration removed by @if or static elimination