Fixed optimize imports for operators

This commit is contained in:
Valentin Kipyatkov
2016-09-30 01:19:59 +03:00
parent 95a3a29382
commit 17adee68cd
14 changed files with 141 additions and 23 deletions
@@ -0,0 +1,7 @@
package p1
operator fun Runnable.plus(p: Int): Runnable = TODO()
operator fun Runnable.minus(p: Int): Runnable = TODO()
operator fun Runnable.timesAssign(p: Int): Unit = TODO()
operator fun Runnable.div(p: Int): Runnable = TODO()
operator fun Runnable.unaryMinus(): Runnable = TODO()
+9
View File
@@ -0,0 +1,9 @@
// NAME_COUNT_TO_USE_STAR_IMPORT: 5
import p1.*
fun f(runnable: Runnable) {
var r = -runnable
print(r + 1)
r /= 2
r *= 3
}
+12
View File
@@ -0,0 +1,12 @@
// NAME_COUNT_TO_USE_STAR_IMPORT: 5
import p1.div
import p1.plus
import p1.timesAssign
import p1.unaryMinus
fun f(runnable: Runnable) {
var r = -runnable
print(r + 1)
r /= 2
r *= 3
}
@@ -0,0 +1,3 @@
package p1
operator fun Runnable.plus(p: Int): Runnable = TODO()
@@ -0,0 +1,7 @@
package p2
operator fun Runnable.plusAssign(p: Int): Unit = TODO()
val v1 = 1
val v2 = 1
val v3 = 1
@@ -0,0 +1,11 @@
// NAME_COUNT_TO_USE_STAR_IMPORT: 2
import p1.plus
import p2.v1
import p2.v2
import p2.v3
fun f(runnable: Runnable) {
var r = runnable
r += 1
v1 + v2 + v3
}
@@ -0,0 +1,11 @@
// NAME_COUNT_TO_USE_STAR_IMPORT: 2
import p1.plus
import p2.v1
import p2.v2
import p2.v3
fun f(runnable: Runnable) {
var r = runnable
r += 1
v1 + v2 + v3
}
@@ -0,0 +1,3 @@
Additional checking of reference KtSimpleNameReference: +=
Changed resolve of KtSimpleNameReference: +=
Trying to build import list again with locked imports: -p2.*, p1.plus