Why can't I take out the subclasses of a sealed type outside of the class definition in script files, like you can do with normal Kotlin files?
c
Czar
01/28/2020, 7:07 PM
kotlin script is not the same as a kotlin file. For kotlinc script is kind of like a class.
For example take a look at this:
Copy code
private val a = ""
class Z {
val zA = a
}
if it was a normal kotlin file, this would work. But in a script this won't because for kotlinc a is defined in the script class, and inner classes cannot see private properties of the parent class. Same goes for sealed, you cannot do something like this: