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.
This commit is contained in:
Dmitry Savvinov
2017-12-14 18:59:32 +03:00
parent acd8edaa9c
commit d570b863ce
117 changed files with 8027 additions and 113 deletions
@@ -8,7 +8,7 @@ public class C {
open class <!CYCLIC_SCOPES_WITH_COMPANION!>Base<!> ()
class Foo : Data()
class Foo : <!DEPRECATED_ACCESS_BY_SHORT_NAME!>Data<!>()
companion <!CYCLIC_SCOPES_WITH_COMPANION!>object<!> : DerivedAbstract()
}
@@ -7,11 +7,11 @@ object WithFunctionInBase {
public class C {
// error-scope
val data: <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Data<!> = Data()
val data: <!DEPRECATED_ACCESS_BY_SHORT_NAME, DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Data<!> = Data()
open class <!CYCLIC_SCOPES_WITH_COMPANION!>Base<!>() {
// error-scope
fun foo(): <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Int<!> = 42
fun foo(): <!DEPRECATED_ACCESS_BY_SHORT_NAME, DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Int<!> = 42
}
companion <!CYCLIC_SCOPES_WITH_COMPANION!>object<!> : DerivedAbstract()
@@ -29,11 +29,11 @@ object WithPropertyInBase {
open class <!CYCLIC_SCOPES_WITH_COMPANION!>Base<!>() {
// error-scope
val foo: <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Int<!> = 42
val foo: <!DEPRECATED_ACCESS_BY_SHORT_NAME, DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Int<!> = 42
}
// error-scope
val data: <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Data<!> = Data()
val data: <!DEPRECATED_ACCESS_BY_SHORT_NAME, DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Data<!> = Data()
companion <!CYCLIC_SCOPES_WITH_COMPANION!>object<!> : DerivedAbstract()
}