v0.13.7
errors and warnings / classes

errors and warnings / classes / E3005

E3005 error

override problem: missing override, or nothing to override

area
classes (x3xxx)
fails the build
yes

A problem with override: a method or accessor replaces one a superclass declares (or implements an abstract one) without override, or it is marked override but no superclass declares it. The keyword makes replacing a method a visible choice and catches a misspelt name. Add or remove override, or fix the name.

Example

× failswowlua
class Animal    function speak(): string        return "..."    endendclass Dog extends Animal    function speak(): string        return "woof"    endendprint(Dog.new():speak())
✓ compileswowlua
class Animal    function speak(): string        return "..."    endendclass Dog extends Animal    override function speak(): string        return "woof"    endendprint(Dog.new():speak())

The compiler reports it like this:

error[E3005]: `speak` overrides a member of a superclass; mark it `override`
  ┌─ src/main.wowlua:7:14
  │
2 │     function speak(): string
  │              ----- overridden member
  ·
7 │     function speak(): string
  │              ^^^^^ missing `override`
codemessage
E3003Abstract method not implemented

Offline

terminal
$ wowlua explain E3005
E3005 (error): override problem: missing override, or nothing to override

source on GitHub ↗