Move: Fix processing of implicit extension 'invoke' calls

Also fix bogus "unused import" inspection reported on such calls

 #KT-17496 Fixed
This commit is contained in:
Alexey Sedunov
2017-04-20 15:18:45 +03:00
parent c492f339e6
commit f575e2710f
21 changed files with 250 additions and 11 deletions
@@ -0,0 +1,4 @@
package bar
class CrExtended
@@ -0,0 +1,17 @@
package foo
import bar.CrExtended
fun test(ce: CrExtended) {
valWithFunType()
ce.valWithExtFunType()
with(1) {
extValWithFunType()
ce.extValWithExtFunType()
}
::valWithFunType
::valWithExtFunType
1::extValWithFunType
1::extValWithExtFunType
}
@@ -0,0 +1,9 @@
package foo
import bar.CrExtended
val valWithFunType = fun (): Unit {}
val valWithExtFunType = fun CrExtended.(): Unit {}
val Int.extValWithFunType get() = fun (): Unit {}
val Int.extValWithExtFunType get() = fun CrExtended.(): Unit {}
@@ -0,0 +1,19 @@
package bar
import foo.*
class CrExtended
fun <caret>test(ce: CrExtended) {
valWithFunType()
ce.valWithExtFunType()
with(1) {
extValWithFunType()
ce.extValWithExtFunType()
}
::valWithFunType
::valWithExtFunType
1::extValWithFunType
1::extValWithExtFunType
}
@@ -0,0 +1,9 @@
package foo
import bar.CrExtended
val valWithFunType = fun (): Unit {}
val valWithExtFunType = fun CrExtended.(): Unit {}
val Int.extValWithFunType get() = fun (): Unit {}
val Int.extValWithExtFunType get() = fun CrExtended.(): Unit {}
@@ -0,0 +1,5 @@
{
"mainFile": "bar/test.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "foo"
}
@@ -0,0 +1,21 @@
package baz
import bar.CrExtended
import foo.extValWithExtFunType
import foo.extValWithFunType
import foo.valWithExtFunType
import foo.valWithFunType
fun test(ce: CrExtended) {
valWithFunType()
ce.valWithExtFunType()
with(1) {
extValWithFunType()
ce.extValWithExtFunType()
}
::valWithFunType
::valWithExtFunType
1::extValWithFunType
1::extValWithExtFunType
}
@@ -0,0 +1,9 @@
package foo
import bar.CrExtended
val valWithFunType = fun (): Unit {}
val valWithExtFunType = fun CrExtended.(): Unit {}
val Int.extValWithFunType get() = fun (): Unit {}
val Int.extValWithExtFunType get() = fun CrExtended.(): Unit {}
@@ -0,0 +1,19 @@
package bar
import foo.*
class CrExtended
fun <caret>test(ce: CrExtended) {
valWithFunType()
ce.valWithExtFunType()
with(1) {
extValWithFunType()
ce.extValWithExtFunType()
}
::valWithFunType
::valWithExtFunType
1::extValWithFunType
1::extValWithExtFunType
}
@@ -0,0 +1,9 @@
package foo
import bar.CrExtended
val valWithFunType = fun (): Unit {}
val valWithExtFunType = fun CrExtended.(): Unit {}
val Int.extValWithFunType get() = fun (): Unit {}
val Int.extValWithExtFunType get() = fun CrExtended.(): Unit {}
@@ -0,0 +1,5 @@
{
"mainFile": "bar/test.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "baz"
}
@@ -0,0 +1,21 @@
package bar
import foo.CrExtended
import foo.extValWithExtFunType
import foo.extValWithFunType
import foo.valWithExtFunType
import foo.valWithFunType
fun test(ce: CrExtended) {
valWithFunType()
ce.valWithExtFunType()
with(1) {
extValWithFunType()
ce.extValWithExtFunType()
}
::valWithFunType
::valWithExtFunType
1::extValWithFunType
1::extValWithExtFunType
}
@@ -0,0 +1,9 @@
package foo
val valWithFunType = fun (): Unit {}
val valWithExtFunType = fun CrExtended.(): Unit {}
val Int.extValWithFunType get() = fun (): Unit {}
val Int.extValWithExtFunType get() = fun CrExtended.(): Unit {}
class CrExtended
@@ -0,0 +1,22 @@
package foo
val valWithFunType = fun (): Unit {}
val valWithExtFunType = fun CrExtended.(): Unit {}
val Int.extValWithFunType get() = fun (): Unit {}
val Int.extValWithExtFunType get() = fun CrExtended.(): Unit {}
class CrExtended
fun <caret>test(ce: CrExtended) {
valWithFunType()
ce.valWithExtFunType()
with(1) {
extValWithFunType()
ce.extValWithExtFunType()
}
::valWithFunType
::valWithExtFunType
1::extValWithFunType
1::extValWithExtFunType
}
@@ -0,0 +1,5 @@
{
"mainFile": "foo/test.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "bar"
}