errors and warnings / names / W1035
W1035 warning
Usage-analysis dependency contradicts build.load-order; the listed order is kept (contradicting imports are E1035)
- area
- names (x1xxx)
- fails the build
- with --deny-warnings
build.load-order lists a file before one whose definitions it uses while
loading, as found by usage analysis (globals, addon-namespace fields). The
listed order wins, because the analysis can over-approximate without types
and wowlua init writes the order of a TOC that worked. If the warning is
right, reorder the list; if the use really happens later, the warning can be
silenced in check.lints.
Example
{ "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" }, "flavors": { "camelot": {} }, "build": { "load-order": ["src/main.lua", "src/util.lua"] }}print(MyAddonGreeting)MyAddonGreeting = "hi"{ "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" }, "flavors": { "camelot": {} }, "build": { "load-order": ["src/util.lua", "src/main.lua"] }}print(MyAddonGreeting)MyAddonGreeting = "hi"The compiler reports it like this:
warning[W1035]: `build.load-order` loads `main.lua` before `util.lua`, which uses a name it defines; keeping the listed order ┌─ src/main.lua:1:7 │ 1 │ print(MyAddonGreeting) │ ^^^^^^^^^^^^^^^ `main.lua` uses `MyAddonGreeting` from `util.lua` while it loads │ = help: if the listed order is wrong, change `build.load-order`; otherwise move the use into a function that runs later
Related codes
| code | message |
|---|---|
| E1035 | build.load-order contradicts a computed load-time dependency |
| W1033 | Load order cannot be determined (dynamic names, several writers, external names); files keep their source order |
Offline
$ wowlua explain W1035 W1035 (warning): Usage-analysis dependency contradicts build.load-order; the listed order is kept (contradicting imports are E1035)