Change Signature: Skip implicit receiver references if extension receiver is dropped

This commit is contained in:
Alexey Sedunov
2016-02-08 14:36:24 +03:00
parent a9ddc4da1a
commit 8e81d0ce5f
4 changed files with 11 additions and 9 deletions
@@ -370,7 +370,9 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor {
val targetDescriptor = implicitReceiver.declarationDescriptor
if (compareDescriptors(callElement.project, targetDescriptor, callableDescriptor)) {
assert(originalReceiverInfo != null) { "No original receiver info provided: " + functionUsageInfo.declaration.text }
result.add(KotlinImplicitThisToParameterUsage(callElement, originalReceiverInfo!!, functionUsageInfo))
if (originalReceiverInfo in changeInfo.getNonReceiverParameters()) {
result.add(KotlinImplicitThisToParameterUsage(callElement, originalReceiverInfo!!, functionUsageInfo))
}
}
else {
result.add(KotlinImplicitThisUsage(callElement, targetDescriptor))
@@ -1,11 +1,11 @@
fun foo(s: String, k: Int): Boolean {
return this.k + s.length - k > 0
return this.k + s.length - k - l > 0
}
class X(val k: Int)
class X(val k: Int, val l: Int)
fun test() {
with(X(0)) {
with(X(0, 1)) {
foo("1", 2)
}
foo("1", 2)
@@ -1,5 +1,5 @@
class J {
void test() {
RemoveReceiverBeforeKt.foo(new X(0), "1", 2);
RemoveReceiverBeforeKt.foo(new X(0, 1), "1", 2);
}
}
@@ -1,12 +1,12 @@
fun X.<caret>foo(s: String, k: Int): Boolean {
return this.k + s.length - k > 0
return this.k + s.length - k - l > 0
}
class X(val k: Int)
class X(val k: Int, val l: Int)
fun test() {
with(X(0)) {
with(X(0, 1)) {
foo("1", 2)
}
X(0).foo("1", 2)
X(0, 1).foo("1", 2)
}