This inner enum doesn't compile

class Outer {
    inner class Inner {
        enum class EnumClass {
            enumElement0,
            enumElement1
        }
    }
}

I have an inner class that contains an enum, but if I mark the class as inner, it does not compile. I want to understand WHY it doesn’t compile more than a solution.

Similar problem with:

class Outer {
    inner class Inner {
        companion object {
            val val0 = 0        
        }
    }
}

TY

See syntax - Is there a way to nest an enum within a data class in Kotlin? - Stack Overflow