Add inspection to highlight unnecessary explicit companion references
So #KT-22971 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
4c5913f5a3
commit
3fbf85dc37
@@ -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()
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class C {
|
||||
companion object {
|
||||
fun create() = C()
|
||||
}
|
||||
fun test() {
|
||||
create()
|
||||
}
|
||||
}
|
||||
+8
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user