Rename: Make improvements for "by-convention" calls

- Convert between conventions call for 'get' and 'invoke'
- Drop 'operator' when converting 'get'/'invoke' to something other than
  'invoke'/'get' respectively

 #KT-12365 Fixed
This commit is contained in:
Alexey Sedunov
2018-01-30 17:41:00 +03:00
parent caeb594e09
commit f35af11423
16 changed files with 163 additions and 11 deletions
+7
View File
@@ -0,0 +1,7 @@
class A {
operator fun <caret>get(n: Int, s: String) = 1
}
fun test() {
A()[1, "2"]
}
@@ -0,0 +1,7 @@
class A {
fun foo(n: Int, s: String) = 1
}
fun test() {
A().foo(1, "2")
}
@@ -0,0 +1,7 @@
class A {
operator fun <caret>get(n: Int, s: String) = 1
}
fun test() {
A()[1, "2"]
}
@@ -0,0 +1,7 @@
class A {
operator fun invoke(n: Int, s: String) = 1
}
fun test() {
A()(1, "2")
}
+7
View File
@@ -0,0 +1,7 @@
class A {
operator fun <caret>get(n: Int, s: String) = 1
}
fun test() {
A()[1, "2"]
}
@@ -0,0 +1,7 @@
class A {
fun plus(n: Int, s: String) = 1
}
fun test() {
A().plus(1, "2")
}
@@ -0,0 +1,7 @@
class A {
operator fun <caret>invoke(n: Int, s: String) = 1
}
fun test() {
A()(1, "2")
}
@@ -0,0 +1,7 @@
class A {
fun foo(n: Int, s: String) = 1
}
fun test() {
A().foo(1, "2")
}
@@ -0,0 +1,7 @@
class A {
operator fun <caret>invoke(n: Int, s: String) = 1
}
fun test() {
A()(1, "2")
}
@@ -0,0 +1,7 @@
class A {
operator fun get(n: Int, s: String) = 1
}
fun test() {
A()[1, "2"]
}
@@ -0,0 +1,7 @@
class A {
operator fun <caret>invoke(n: Int, s: String) = 1
}
fun test() {
A()(1, "2")
}
@@ -0,0 +1,7 @@
class A {
fun plus(n: Int, s: String) = 1
}
fun test() {
A().plus(1, "2")
}