Files
kotlin-fork/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNestedJava.kt
T
Dmitry Savvinov d570b863ce Introduce deprecation of companion objects nested classes
Introdude deprecation as per KT-21515. Warning is reported on type
usage, that soon will became invisible. Quickfix by adding explicit
import is added.

Idea behind implementation is to mark scopes that are deprecated (see
ClassResolutionScopesSupport).

Then, during walk along hierarchy of scopes, look at deprecation status
of the scope that has provided this classifier.
Note that we also have to check if there are *some* non-deprecated
visibility paths (because we can see classifier by two paths, e.g. if
we've added explicit import) -- then this type reference shouldn't be
treated as deprecated.
2018-02-21 16:04:49 +03:00

47 lines
701 B
Kotlin
Vendored

// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// FILE: 1.kt
open class A {
class Y {
fun A_Y() {}
}
companion object {
class Z {
fun A_C_Z() {}
}
}
}
// FILE: B.java
public class B extends A {
class Y {
void B_Y() {}
}
class Z {
void B_Z() {}
}
}
// FILE: C.java
public class C extends A {}
// FILE: 2.kt
class E: B() {
init {
Y().B_Y()
Y().<!UNRESOLVED_REFERENCE!>A_Y<!>()
Z().B_Z()
Z().<!UNRESOLVED_REFERENCE!>A_C_Z<!>()
}
}
class Y: C() {
init {
Y().A_Y()
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>Z()<!>.A_C_Z()
}
}