Private classes in "parallel" files in same package

In https://kotlinlang.org/docs/reference/visibility-modifiers.html it says

Packages : If you mark a declaration private, it will only be visible inside the file containing the declaration;

But I have a package X

and have file A.kt

package X
private data class D(val a:Int)

and file B.kt

package X
private data class D(val a:Int)

I get redefinition errors both from IDE and compiler. Am I understanding incorrectly ? Shouldn’t I be allowed to name the class with same name in A and B, since it is only visible within the “file containing the declaration” ?

Thanks

The problem with the JVM is that even for private classes the name is still public (and cannot be shadowed). Some form of name mangling (either the class or the package the class lives in) would be needed. Perhaps this is something that the compiler should do, so it would be worth filing a bug/feature request.