KT-9950 IntelliJ IDEA does not suggest importing extension methods which have the same name as an instance method
#KT-9950 Fixed
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "false"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
// ACTION: Add parameter to function 'foo'
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create extension function 'X.foo'
|
||||
// ACTION: Create member function 'X.foo'
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
this.foo(<caret>1)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(p: String) {
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: The integer literal does not conform to the expected type String
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo(p: String) {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo(<caret>1)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(p: Int) {
|
||||
}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: The integer literal does not conform to the expected type String
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X {
|
||||
fun foo(p: String) {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo(<caret>1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: No value passed for parameter p
|
||||
// ERROR: Type mismatch: inferred type is Unit but String was expected
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo(p: Int) {
|
||||
}
|
||||
|
||||
fun f(): String {
|
||||
return foo(<caret>)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun <T> X.foo(): T = TODO()
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: No value passed for parameter p
|
||||
// ERROR: Type mismatch: inferred type is Unit but String was expected
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X {
|
||||
fun foo(p: Int) {
|
||||
}
|
||||
|
||||
fun f(): String {
|
||||
return foo(<caret>)
|
||||
}
|
||||
}
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
fun f(x: X) {
|
||||
x.foo(<caret>1)
|
||||
}
|
||||
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(p: Int) {
|
||||
}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
fun f(x: X) {
|
||||
x.foo(<caret>1)
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo(<caret>1)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(p: Int) {
|
||||
}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo(<caret>1)
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "false"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
// ACTION: Add parameter to function 'foo'
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create extension function 'X.foo'
|
||||
// ACTION: Create member function 'X.foo'
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
fun f(x: X) {
|
||||
x.foo(<caret>1)
|
||||
}
|
||||
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun String.foo(p: Int) {
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
// ERROR: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: <br>public operator fun String?.plus(other: Any?): String defined in kotlin
|
||||
// ERROR: Unresolved reference: XXX
|
||||
// ERROR: Unresolved reference: xxx
|
||||
|
||||
package main
|
||||
|
||||
class X : XXX {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo(<caret>1) + xxx()
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(p: Int) {
|
||||
}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
// ERROR: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: <br>public operator fun String?.plus(other: Any?): String defined in kotlin
|
||||
// ERROR: Unresolved reference: XXX
|
||||
// ERROR: Unresolved reference: xxx
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X : XXX {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo(<caret>1) + xxx()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Type mismatch: inferred type is () -> Unit but Int was expected
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo(p: Int) {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo {<caret>}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(filter: (String) -> Boolean){}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Type mismatch: inferred type is () -> Unit but Int was expected
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X {
|
||||
fun foo(p: Int) {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo {<caret>}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Cannot find a parameter with this name: p2
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f(p: Int) {
|
||||
foo(<caret>p2 = 0)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(p1: Int = 1, p2: Int = 2, p3: Int = 3){}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Cannot find a parameter with this name: p2
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f(p: Int) {
|
||||
foo(<caret>p2 = 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "false"
|
||||
// ERROR: Type mismatch: inferred type is Int but String was expected
|
||||
// ACTION: Add 'toString()' call
|
||||
// ACTION: Change parameter 'p' type of function 'main.X.foo' to 'Int'
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create function 'foo'
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo(p: String) {
|
||||
}
|
||||
|
||||
fun f(p: Int) {
|
||||
foo(<caret>p, )
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(p: Int) {
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f(p: Any) {
|
||||
if (p is String) {
|
||||
foo(<caret>p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(p: String) {
|
||||
}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f(p: Any) {
|
||||
if (p is String) {
|
||||
foo(<caret>p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo(<caret>1)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
fun foo(p: Int) {
|
||||
}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
foo(<caret>1)
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "false"
|
||||
// ERROR: Too many arguments for public final fun foo(): Unit defined in main.X
|
||||
// ACTION: Add parameter to function 'foo'
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create extension function 'X.foo'
|
||||
// ACTION: Create member function 'X.foo'
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
this.foo(<caret>1)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
fun foo(p: Int) {
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Type mismatch: inferred type is Int but String was expected
|
||||
|
||||
package main
|
||||
|
||||
class X {
|
||||
fun foo(p: String) {
|
||||
}
|
||||
|
||||
fun f(p: Int) {
|
||||
foo(<caret>p)
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package other
|
||||
|
||||
import main.X
|
||||
|
||||
fun X.foo(p: Int) {
|
||||
}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Type mismatch: inferred type is Int but String was expected
|
||||
|
||||
package main
|
||||
|
||||
import other.foo
|
||||
|
||||
class X {
|
||||
fun foo(p: String) {
|
||||
}
|
||||
|
||||
fun f(p: Int) {
|
||||
foo(<caret>p)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user