Optimization

This commit is contained in:
Valentin Kipyatkov
2016-09-02 16:00:33 +03:00
parent 0f32574be0
commit 5ce780cafc
9 changed files with 33 additions and 16 deletions
+4 -1
View File
@@ -2,10 +2,13 @@
// OPTIONS: usages
class B(val n: Int) {
operator fun <caret>get(i: Int): B = B(i)
operator fun <caret>get(i: Int) = ""
operator fun set(i: Int, s: String)
}
fun test() {
B(1).get(2)
B(1)[2]
val b = B(2)
b[3] = "a"
}
+2 -1
View File
@@ -1,5 +1,6 @@
Checked type of b
Resolved B(1)[2]
Searched references to B
Searched references to B.get(i: Int) in Kotlin files
Searched references to b in Kotlin files
Used plain search of B.get(i: Int) in LocalSearchScope:
CLASS:B
@@ -1,2 +1,2 @@
Function call 9 B(1).get(2)
Implicit 'get' 10 B(1)[2]
Function call 10 B(1).get(2)
Implicit 'get' 11 B(1)[2]
+4 -2
View File
@@ -3,11 +3,13 @@
class B(val n: Int) {
operator fun <caret>set(i: Int, a: B) {}
operator fun inc() {}
}
fun test() {
var a = B(1)
a.set(2, B(2))
a[2] = B(2)
a[2]
a[1] = B(2)
a[2]++
a[3]
}
+1 -1
View File
@@ -1,5 +1,5 @@
Checked type of a
Resolved a[2]
Resolved a[1]
Resolved a[2]
Searched references to B
Searched references to a in Kotlin files
@@ -1,2 +1,3 @@
Function call 10 a.set(2, B(2))
Implicit 'set' 11 a[2] = B(2)
Function call 11 a.set(2, B(2))
Implicit 'set' 12 a[1] = B(2)
Unclassified usage 13 a[2]++