Files
kotlin-fork/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNested.fir.kt
T
Tianyu Geng fb14b03824 FIR checker: skip error named reference if receiver is unresolved
Currently, FIR reports errors caused by previous resolution failure. For
example with unresolved `a` and `b` in code `a.b`, both `a` and `b` are
highlighted. FE1.0 only highlights `a` since it's the root cause. This
change applies this heuristics when reporting FirDiagnostics.
2021-03-29 12:45:27 +03:00

96 lines
1.5 KiB
Kotlin
Vendored

// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
open class A {
class X {
fun A_X() {}
}
class Y {
fun A_Y() {}
}
companion object {
class X {
fun A_C_X() {}
}
class Z {
fun A_C_Z() {}
}
}
init {
X().A_X()
X().<!UNRESOLVED_REFERENCE!>A_C_X<!>()
}
}
class Simple: A() {
init {
Y().A_Y()
<!UNRESOLVED_REFERENCE!>Z<!>().A_C_Z()
}
}
class B: A() {
class Y {
fun B_Y() {}
}
class Z {
fun B_Z() {}
}
init {
X().A_X()
X().<!UNRESOLVED_REFERENCE!>A_C_X<!>()
Y().B_Y()
Y().<!UNRESOLVED_REFERENCE!>A_Y<!>()
Z().B_Z()
Z().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
}
companion object {
init {
X().A_X()
X().<!UNRESOLVED_REFERENCE!>A_C_X<!>()
Y().B_Y()
Y().<!UNRESOLVED_REFERENCE!>A_Y<!>()
Z().B_Z()
Z().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
}
}
}
class C: A() {
companion object {
class Y {
fun C_C_Y() {}
}
class Z {
fun C_C_Z() {}
}
init {
Y().C_C_Y()
Y().<!UNRESOLVED_REFERENCE!>A_Y<!>()
Z().C_C_Z()
Z().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
}
}
init {
Y().C_C_Y()
Y().<!UNRESOLVED_REFERENCE!>A_Y<!>()
Z().C_C_Z()
Z().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
}
}