errors and warnings / classes / E3020
E3020 error
Unknown decorator
- area
- classes (x3xxx)
- fails the build
- yes
A decorator name is neither a core decorator nor a local or imported binding.
Decorators never resolve to globals by themselves: import the decorator, or
define it as a local function before its use, or write @_G.Name to look it
up in the global environment at load time. Framework decorators such as
@event need their import (import event from "wowlua:events").
Example
@memoizelocal function lookup(id: number): number return id * 2endprint(lookup(1))local function memoize<A, R>(fn: (A) -> R, ctx: DecoratorContext): (A) -> R print(ctx.name) return fnend @memoizelocal function lookup(id: number): number return id * 2endprint(lookup(1))The compiler reports it like this:
error[E3020]: unknown decorator `@memoize`; decorators are core decorators, local or imported functions, or `@_G.…` ┌─ src/main.wowlua:1:1 │ 1 │ @memoize │ ^^^^^^^^ here
Related codes
| code | message |
|---|---|
| E3021 | Decorator not applicable to this target (including user decorators on enums, interfaces and aliases) |
Offline
$ wowlua explain E3020 E3020 (error): Unknown decorator