"Redundant Companion": Don't suggest if same callable name is in use

So #KT-24425 Fixed
This commit is contained in:
Toshiaki Kameyama
2018-06-06 16:37:27 +03:00
committed by Mikhail Glukhikh
parent a2435ff3b0
commit 5ad98a139d
15 changed files with 252 additions and 2 deletions
@@ -0,0 +1,11 @@
class Test {
companion object {
fun f(x: Int, y: Int) = 1
}
fun f(x: Int, y: String) = 2
fun test() {
<caret>Companion.f(1, 2)
}
}
@@ -0,0 +1,11 @@
class Test {
companion object {
fun f(x: Int, y: Int) = 1
}
fun f(x: Int, y: String) = 2
fun test() {
f(1, 2)
}
}
@@ -0,0 +1,13 @@
// PROBLEM: none
class Test {
companion object {
fun extentionFun() = 1
}
fun test() {
<caret>Companion.extentionFun()
}
}
fun Test.extentionFun() = 2
@@ -0,0 +1,14 @@
// PROBLEM: none
class Test {
companion object {
val extentionVar = 1
}
fun test() {
<caret>Companion.extentionVar
}
}
val Test.extentionVar: Int
get() = 2
@@ -0,0 +1,11 @@
class Test {
companion object {
fun globalFun() = 1
}
fun test() {
<caret>Companion.globalFun()
}
}
fun globalFun() = 2
@@ -0,0 +1,11 @@
class Test {
companion object {
fun globalFun() = 1
}
fun test() {
globalFun()
}
}
fun globalFun() = 2
@@ -0,0 +1,11 @@
class Test {
companion object {
val globalVar = 1
}
fun test() {
<caret>Companion.globalVar
}
}
val globalVar = 2
@@ -0,0 +1,11 @@
class Test {
companion object {
val globalVar = 1
}
fun test() {
globalVar
}
}
val globalVar = 2
@@ -0,0 +1,13 @@
// PROBLEM: none
class Test {
companion object {
fun localFun() = 1
}
fun test() {
fun localFun() = 2
<caret>Companion.localFun()
}
}
@@ -0,0 +1,13 @@
// PROBLEM: none
class Test {
companion object {
val localVar = 1
}
fun test() {
var localVar = 2
<caret>Companion.localVar
}
}
@@ -0,0 +1,11 @@
// PROBLEM: none
class Test {
companion object {
val localVar = 1
}
fun test(localVar: Int) {
<caret>Companion.localVar
}
}
@@ -0,0 +1,13 @@
// PROBLEM: none
class Test {
companion object {
fun memberFun(x: Int) = 1
}
fun memberFun(x: Int) = 2
fun test() {
<caret>Companion.memberFun(0)
}
}
@@ -0,0 +1,13 @@
// PROBLEM: none
class Test {
companion object {
val memberVar = 1
}
val memberVar = 2
fun test() {
<caret>Companion.memberVar
}
}