Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/expresssions/privateVisibility.kt
T
Dmitriy Novozhilov f283f2db43 [FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00

76 lines
1.3 KiB
Kotlin
Vendored

// FILE: first.kt
private fun foo() {}
private class Private {
private fun bar() {}
fun baz() {
bar()
Nested()
fromCompanion()
NotCompanion.<!HIDDEN!>foo<!>() // hidden
}
inner class Inner {
fun foo() {
bar()
fromCompanion()
NotCompanion.<!HIDDEN!>foo<!>() // hidden
}
}
private class Nested {
fun foo() {
fromCompanion()
NotCompanion.<!HIDDEN!>foo<!>() // hidden
}
}
companion object {
private fun fromCompanion() {}
}
object NotCompanion {
private fun foo() {}
}
}
fun withLocals() {
class Local {
private fun bar()
fun baz() {
bar()
Inner()
}
private inner class Inner {
fun foo() {
bar()
}
}
}
Local().baz()
Local().<!HIDDEN!>bar<!>() // hidden
}
fun test() {
foo()
Private().baz()
Private().Inner()
Private().<!HIDDEN!>bar<!>() // hidden
Private.<!HIDDEN!>Nested<!>() // hidden
Private.<!HIDDEN!>fromCompanion<!>() // hidden
}
// FILE: second.kt
fun secondTest() {
<!HIDDEN!>foo<!>() // hidden
<!HIDDEN!>Private<!>() // hidden
}