There are cases where internal types are not leaked, but the compiler complains regardless.
Example:
internal class InternalClass()
sealed class SealedClass() {
protected fun ExposesInternal(): InternalClass {
...
}
}
In this case the compiler complains that the ExposesInternal function exposes InternalClass, but given that the class that is using it is a sealed class and the function has protected visibility this is not the case.