v0.13.7
errors and warnings / classes

errors and warnings / classes / W3021

W3021 warning

Lexical binding named like a core decorator is not a re-export of it (ignored in decorator position)

area
classes (x3xxx)
fails the build
with --deny-warnings

A local or imported function has a core decorator's name (profile, trace, …) but isn't a re-export of that decorator. In decorator position a core decorator's name always means the core decorator, so @profile ignores your function; the warning is reported where @profile is written. Import it under another name (import profile as myProfile from "./perf") and write @myProfile. Re-exports such as import profile from "wowlua:debug" are fine.

Example

× failswowlua
local function profile(fn: () -> (), _ctx: DecoratorContext)    return fnend @profilelocal function refresh()endrefresh()print(profile)
✓ compileswowlua
local function measured(fn: () -> (), _ctx: DecoratorContext)    return fnend @measuredlocal function refresh()endrefresh()

The compiler reports it like this:

warning[W3021]: `@profile` is the core decorator: the function `profile` in scope is not used here
  ┌─ src/main.wowlua:5:1
  │
5 │ @profile
  │ ^^^^^^^^ the core decorator
  │
  = help: to decorate with your function, import it under another name (`import profile as myProfile from …`) and write that name
codemessage
E3020Unknown decorator

Offline

terminal
$ wowlua explain W3021
W3021 (warning): Lexical binding named like a core decorator is not a re-export of it (ignored in decorator position)

source on GitHub ↗