Why can't I take out the subclasses of a sealed ty...
# announcements
k
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
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:
Copy code
class P {
	sealed class Z
	class C : Z()
}
so
Copy code
sealed class Z
class C : Z()
doesn't work in the kotlin script either.