E110: Cyclic Inheritance
This error is emitted when a class or trait extends itself, directly or indirectly.
Cyclic inheritance is prohibited in Scala because it would create an impossible situation where a class needs to be fully defined before it can extend itself.
Example
class A extends A
Error
-- [E110] Syntax Error: example.scala:1:16 -------------------------------------
1 |class A extends A
| ^
| Cyclic inheritance: class A extends itself
|-----------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| Cyclic inheritance is prohibited in Dotty.
| Consider the following example:
|
| class A extends A
|
| The example mentioned above would fail because this type of inheritance hierarchy
| creates a "cycle" where a not yet defined class A extends itself which makes
| impossible to instantiate an object of this class
-----------------------------------------------------------------------------
Solution
// Remove the cyclic inheritance
class A
// Or create a proper inheritance hierarchy
class Base
class A extends Base
In this article