v0.13.7
errors and warnings / classes

errors and warnings / classes / E3006

E3006 error

Class does not satisfy an implemented interface

area
classes (x3xxx)
fails the build
yes

A class says implements I but doesn't satisfy the interface I: a member is missing, or its type doesn't fit. Add the member or fix its type.

Only public members count, as where an instance is used as the interface: a private or protected member doesn't satisfy it. Members the class inherits do, and so do those of the interfaces the interface extends.

Example

× failswowlua
interface Pet    name: string    function play(): booleanendclass Dog implements Pet    name: string = "Rex"endprint(Dog)
✓ compileswowlua
interface Pet    name: string    function play(): booleanendclass Dog implements Pet    name: string = "Rex"    function play(): boolean        return true    endendprint(Dog)

The compiler reports it like this:

error[E3006]: class `Dog` does not satisfy `Pet`: it has no public `play`
  ┌─ src/main.wowlua:5:22
  │
5 │ class Dog implements Pet
  │                      ^^^ here
codemessage
E2001Type mismatch: S is not assignable to T

Offline

terminal
$ wowlua explain E3006
E3006 (error): Class does not satisfy an implemented interface

source on GitHub ↗