If you are in a function in a supertype and have a...
# announcements
k
If you are in a function in a supertype and have a variable that is of that type but then smartcasted to a subtype, why do the private functions of the supertype get hidden?
atm I'm getting around it by casting it back to the supertype, but I feel like I shouldn't need to.
k
Can you give us a minimal example?
e
If a class member is private, that means child class instances are unable to access that member. Smart-casting causes Kotlin to treat the variable as a subtype. If you want this behavior, consider making the class member in question protected rather than private or just keep performing the supertype cast.
k
It's annoying if you were to refactor a part earlier in the code which results in a smartcast and creates and error later in said function