Kotlin: Constructor of inner class can be called only with receiver of containing class : <p>I was trying inner classes in Kotlin and came across this error but didn't quite understand it. I tried to look at the documentation <a href="https://kotlinlang.org/docs/reference/nested-classes.html" rel="noreferrer">here</a> but didn't quite get any direction as to how outer classes can access inner class constructors</p>

<pre><code>class OuterClass {

  fun someFun(): InnerClassSuper {
    return InnerClassX("Hello") //Error: Constructor of inner class InnerClassX can be called only with receiver of containing class
  }

  sealed class InnerClassSuper {

    inner class InnerClassX(val x: String): InnerClassSuper()

  }
}
</code></pre>

<p>Would appreciate if someone explains the error and directs how to fix it.
Thanks.</p>
