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:
+13
@@ -0,0 +1,13 @@
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
class FromBarCompanion {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a = <caret>FromBarCompanion::foo
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import Bar.Companion.FromBarCompanion
|
||||
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
class FromBarCompanion {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a = FromBarCompanion::foo
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
class FromBarCompanion {
|
||||
fun foo() = 42
|
||||
|
||||
// We need it to cover another code-path
|
||||
companion object { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a = <caret>FromBarCompanion::foo
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import Bar.Companion.FromBarCompanion
|
||||
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
class FromBarCompanion {
|
||||
fun foo() = 42
|
||||
|
||||
// We need it to cover another code-path
|
||||
companion object { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a = FromBarCompanion::foo
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
object FromBarCompanion {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a = <caret>FromBarCompanion::foo
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import Bar.Companion.FromBarCompanion
|
||||
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
object FromBarCompanion {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a = FromBarCompanion::foo
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
class FromBarCompanion
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a = <caret>FromBarCompanion()
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
import Bar.Companion.FromBarCompanion
|
||||
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
class FromBarCompanion
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a = FromBarCompanion()
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
class FromBarCompanion
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a: <caret>FromBarCompanion? = null
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
import Bar.Companion.FromBarCompanion
|
||||
|
||||
// "Add explicit import" "true"
|
||||
|
||||
open class Bar {
|
||||
companion object {
|
||||
class FromBarCompanion
|
||||
}
|
||||
}
|
||||
|
||||
class Foo : Bar() {
|
||||
val a: FromBarCompanion? = null
|
||||
}
|
||||
Reference in New Issue
Block a user