Add inspection to highlight unnecessary explicit companion references

So #KT-22971 Fixed
This commit is contained in:
Toshiaki Kameyama
2018-03-08 05:32:02 +03:00
committed by Mikhail Glukhikh
parent 4c5913f5a3
commit 3fbf85dc37
12 changed files with 181 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.RedundantCompanionReferenceInspection
@@ -0,0 +1,9 @@
class C {
companion object {
fun create() = C()
}
}
fun test() {
C.<caret>Companion.create()
}
@@ -0,0 +1,9 @@
class C {
companion object {
fun create() = C()
}
}
fun test() {
C.create()
}
@@ -0,0 +1,8 @@
class C {
companion object {
fun create() = C()
}
fun test() {
<caret>Companion.create()
}
}
@@ -0,0 +1,8 @@
class C {
companion object {
fun create() = C()
}
fun test() {
create()
}
}
@@ -0,0 +1,8 @@
// PROBLEM: none
class C {
companion object {
fun foo() {}
}
}
fun test() = C.<caret>Companion::foo
@@ -0,0 +1,10 @@
// PROBLEM: none
class C {
companion object {
fun create() = C()
}
}
fun test() {
<caret>C.create()
}
@@ -0,0 +1,10 @@
// PROBLEM: none
class C {
companion object {
fun create() = C()
}
}
fun test() {
C.<caret>Companion
}