v0.13.8
errors and warnings / classes

errors and warnings / classes / E3003

E3003 error

Abstract method not implemented

area
classes (x3xxx)
fails the build
yes

A concrete class doesn't implement an abstract method it inherits. Implement it with override function, or make the class abstract too. The code is also reported for an abstract method in a class that isn't marked abstract. In debug builds an unimplemented abstract method is a stub that raises an error when called.

Example

× failswowlua
abstract class Shape    abstract function area(): numberendclass Square extends Shape    side: number = 2endprint(Square.new())
✓ compileswowlua
abstract class Shape    abstract function area(): numberendclass Square extends Shape    side: number = 2    override function area(): number        return self.side * self.side    endendprint(Square.new())

The compiler reports it like this:

error[E3003]: class `Square` does not implement the abstract method `area`
  ┌─ src/main.wowlua:4:7
  │
4 │ class Square extends Shape
  │       ^^^^^^ not abstract
codemessage
E3002Cannot instantiate an abstract class
E3005override problem: missing override, or nothing to override

Offline

terminal
$ wowlua explain E3003
E3003 (error): Abstract method not implemented

source on GitHub ↗