kotlin - private visibility modifier and subpackages -
so started experimenting kotlin , stumbled upon this: if top-level declaration marked private, private package it’s declared in ( see visibility modifiers ). since packages nest in kotlin, i.e. package foo.bar considered member of foo, if private in package, visible subpackages. note members of outer packages not imported default, i.e. in file in package foo.bar can’t access members of foo without importing them. from: visibility , package nesting so let's consider following example: file1.kt package foo private fun bar() = println("this bar!!!") and file2.kt package foo.baz import foo.bar fun main(args: array<string>) = bar() from understand function bar() should visible in package foo.baz , callable main(). when try compile above following error message: error: kotlin: cannot access 'bar': 'private' in 'foo' is bug or has spec of language been updated , documentation hasn't? missing somet...