I'm a little bit confused what causes this error `...
# compiler
s
I'm a little bit confused what causes this error
There's a cycle in the inheritance hierarchy for this type
Copy code
class Test : Test2.Children {

    sealed interface Children
}

class Test2 : Test.Children {

    sealed interface Children
}
d
Inside a class you can observe all nested classes/interfaces from superclasses To achieve this compiler need to transitively resolve all supertypes of a class before starting resolution of supertypes of nested classes/interfaces So here you have a following cycle: 1. start resolution of
Test
supertypes (
Test2.Children
) 2. before resolving supertypes of
Test2.Children
, supertypes of
Test2
should be resolved 3. start resolution of
Test.Children
supertype, its own supertypes should be resolved 4. before resolving supertypes of
Test1.Children
, supertypes of
Test1
should be resolved 5. go to 1
s
Thank you, I understand it now. Are there any solutions for this?
d
You need to change the hierarchy For example, move one of Children interfaces to top-level