From 9ec87c01abefd67e1cb726f8ea21133b8de52478 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Thu, 24 Sep 2015 13:40:37 +0300 Subject: [PATCH] Property <-> Function Conversion: Add/remove 'get'/'is' prefixes automatically #KT-8812 Fixed --- .../ConvertFunctionToPropertyIntention.kt | 33 ++++++++++++---- .../ConvertPropertyToFunctionIntention.kt | 38 ++++++++++++------- .../javaUsagesGet.1.java | 7 ++++ .../javaUsagesGet.1.java.after | 7 ++++ .../javaUsagesGet.kt | 3 ++ .../javaUsagesGet.kt.after | 4 ++ .../javaUsagesIs.1.java | 7 ++++ .../javaUsagesIs.1.java.after | 7 ++++ .../convertFunctionToProperty/javaUsagesIs.kt | 3 ++ .../javaUsagesIs.kt.after | 4 ++ .../convertFunctionToProperty/otherRefsGet.kt | 12 ++++++ .../otherRefsGet.kt.after | 13 +++++++ .../convertFunctionToProperty/otherRefsIs.kt | 12 ++++++ .../otherRefsIs.kt.after | 13 +++++++ .../accessorCallGroovy.1.groovy.after | 2 +- .../accessorCallGroovy.kt.after | 2 +- .../blockBody.kt.after | 4 +- .../expressionBody.kt.after | 4 +- .../initializer.kt.after | 4 +- .../javaUsageAsField.1.java | 2 - .../javaUsageAsField.1.java.after | 4 +- .../javaUsageAsField.2.java | 7 ++++ .../javaUsageAsField.2.java.after | 7 ++++ .../javaUsageAsField.kt.after | 2 +- .../javaUsages.1.java.after | 4 +- .../javaUsages.kt.after | 2 +- .../otherRefs.kt.after | 6 +-- .../overrides.1.java.after | 6 +-- .../overrides.kt.after | 10 ++--- .../recursiveAccessor.kt.after | 2 +- .../unchangedElements.kt.after | 4 +- .../intentions/IntentionTestGenerated.java | 24 ++++++++++++ 32 files changed, 207 insertions(+), 52 deletions(-) create mode 100644 idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.1.java create mode 100644 idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.1.java.after create mode 100644 idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.kt create mode 100644 idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.kt.after create mode 100644 idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.1.java create mode 100644 idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.1.java.after create mode 100644 idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.kt create mode 100644 idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.kt.after create mode 100644 idea/testData/intentions/convertFunctionToProperty/otherRefsGet.kt create mode 100644 idea/testData/intentions/convertFunctionToProperty/otherRefsGet.kt.after create mode 100644 idea/testData/intentions/convertFunctionToProperty/otherRefsIs.kt create mode 100644 idea/testData/intentions/convertFunctionToProperty/otherRefsIs.kt.after create mode 100644 idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.2.java create mode 100644 idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.2.java.after diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertFunctionToPropertyIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertFunctionToPropertyIntention.kt index 453cdc8b0db..a0323b94d5c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertFunctionToPropertyIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertFunctionToPropertyIntention.kt @@ -45,8 +45,11 @@ import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.getParentOfTypeAndBranch +import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType import org.jetbrains.kotlin.psi.psiUtil.siblings import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode +import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor import org.jetbrains.kotlin.types.expressions.OperatorConventions import org.jetbrains.kotlin.types.typeUtil.supertypes import java.util.* @@ -61,6 +64,11 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention(project, descriptor, context, getText()) { private val elementsToShorten = ArrayList() + private val newName: String by lazy { + val name = callableDescriptor.name + (SyntheticJavaPropertyDescriptor.propertyNameByGetMethodName(name) ?: name).asString() + } + private fun convertFunction(originalFunction: JetNamedFunction, psiFactory: JetPsiFactory) { val function = originalFunction.copy() as JetNamedFunction @@ -80,6 +88,7 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention() + val kotlinRefsToRename = ArrayList() val foreignRefs = ArrayList() for (callable in callables) { if (callable !is PsiNamedElement) continue @@ -128,8 +138,9 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention { getCalleeExpression() } - if (callElement != null) { + val expression = usage.expression + val callElement = expression.getParentOfTypeAndBranch { getCalleeExpression() } + if (callElement != null && expression.getStrictParentOfType() == null) { if (callElement.getTypeArguments().isNotEmpty()) { conflicts.putValue( callElement, @@ -146,7 +157,9 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention convertFunction(it, psiFactory) - is PsiMethod -> it.setName(getterName) + is PsiMethod -> it.setName(newGetterName) } } @@ -187,13 +203,14 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention(javaClass(), "Convert property to function"), LowPriorityAction { @@ -51,6 +55,7 @@ public class ConvertPropertyToFunctionIntention : JetSelfTargetingIntention(project, descriptor, context, getText()) { + private val newName: String = JvmAbi.getterName(callableDescriptor.name.asString()) private fun convertProperty(originalProperty: JetProperty, psiFactory: JetPsiFactory) { val property = originalProperty.copy() as JetProperty; @@ -74,16 +79,19 @@ public class ConvertPropertyToFunctionIntention : JetSelfTargetingIntention) { val propertyName = callableDescriptor.getName().asString() + val nameChanged = propertyName != newName val getterName = JvmAbi.getterName(callableDescriptor.getName().asString()) val conflicts = MultiMap() val callables = getAffectedCallables(project, descriptorsForChange) - val kotlinRefs = ArrayList() - val foreignRefsToRename = ArrayList() + val kotlinRefsToReplaceWithCall = ArrayList() + val refsToRename = ArrayList() val javaRefsToReplaceWithCall = ArrayList() for (callable in callables) { if (callable !is PsiNamedElement) continue @@ -112,9 +120,12 @@ public class ConvertPropertyToFunctionIntention : JetSelfTargetingIntention() == null) { - kotlinRefs.add(expression) + kotlinRefsToReplaceWithCall.add(expression) + } + else if (nameChanged) { + refsToRename.add(usage) } } else { @@ -129,10 +140,7 @@ public class ConvertPropertyToFunctionIntention : JetSelfTargetingIntention convertProperty(it, kotlinPsiFactory) - is PsiMethod -> it.setName(propertyName) + is PsiMethod -> it.setName(newName) } } } diff --git a/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.1.java b/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.1.java new file mode 100644 index 00000000000..3f3fbb5e085 --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.1.java @@ -0,0 +1,7 @@ +import static test.TestPackage.getFoo; + +class J { + void test() { + boolean b = getFoo(); + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.1.java.after b/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.1.java.after new file mode 100644 index 00000000000..3f3fbb5e085 --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.1.java.after @@ -0,0 +1,7 @@ +import static test.TestPackage.getFoo; + +class J { + void test() { + boolean b = getFoo(); + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.kt b/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.kt new file mode 100644 index 00000000000..8bbba641c4d --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.kt @@ -0,0 +1,3 @@ +package test + +fun getFoo(): Boolean = true \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.kt.after b/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.kt.after new file mode 100644 index 00000000000..fd61f65ed76 --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.kt.after @@ -0,0 +1,4 @@ +package test + +val foo: Boolean + get() = true \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.1.java b/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.1.java new file mode 100644 index 00000000000..4a64376f011 --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.1.java @@ -0,0 +1,7 @@ +import static test.TestPackage.isFoo; + +class J { + void test() { + boolean b = isFoo(); + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.1.java.after b/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.1.java.after new file mode 100644 index 00000000000..4a64376f011 --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.1.java.after @@ -0,0 +1,7 @@ +import static test.TestPackage.isFoo; + +class J { + void test() { + boolean b = isFoo(); + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.kt b/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.kt new file mode 100644 index 00000000000..ea5824d2269 --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.kt @@ -0,0 +1,3 @@ +package test + +fun isFoo(): Boolean = true \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.kt.after b/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.kt.after new file mode 100644 index 00000000000..6149e40a9aa --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.kt.after @@ -0,0 +1,4 @@ +package test + +val isFoo: Boolean + get() = true \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/otherRefsGet.kt b/idea/testData/intentions/convertFunctionToProperty/otherRefsGet.kt new file mode 100644 index 00000000000..b1d6b342ad1 --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/otherRefsGet.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME +package p + +import p.getFoo + +class A(val n: Int) + +fun A.getFoo(): Boolean = n > 1 + +fun test() { + val t = A::getFoo +} \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/otherRefsGet.kt.after b/idea/testData/intentions/convertFunctionToProperty/otherRefsGet.kt.after new file mode 100644 index 00000000000..2808393aa6f --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/otherRefsGet.kt.after @@ -0,0 +1,13 @@ +// WITH_RUNTIME +package p + +import p.foo + +class A(val n: Int) + +val A.foo: Boolean + get() = n > 1 + +fun test() { + val t = A::foo +} \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/otherRefsIs.kt b/idea/testData/intentions/convertFunctionToProperty/otherRefsIs.kt new file mode 100644 index 00000000000..ba158863122 --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/otherRefsIs.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME +package p + +import p.isFoo + +class A(val n: Int) + +fun A.isFoo(): Boolean = n > 1 + +fun test() { + val t = A::isFoo +} \ No newline at end of file diff --git a/idea/testData/intentions/convertFunctionToProperty/otherRefsIs.kt.after b/idea/testData/intentions/convertFunctionToProperty/otherRefsIs.kt.after new file mode 100644 index 00000000000..509088f3daf --- /dev/null +++ b/idea/testData/intentions/convertFunctionToProperty/otherRefsIs.kt.after @@ -0,0 +1,13 @@ +// WITH_RUNTIME +package p + +import p.isFoo + +class A(val n: Int) + +val A.isFoo: Boolean + get() = n > 1 + +fun test() { + val t = A::isFoo +} \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/accessorCallGroovy.1.groovy.after b/idea/testData/intentions/convertPropertyToFunction/accessorCallGroovy.1.groovy.after index 69f9904fdb2..f8d1c9f7f0a 100644 --- a/idea/testData/intentions/convertPropertyToFunction/accessorCallGroovy.1.groovy.after +++ b/idea/testData/intentions/convertPropertyToFunction/accessorCallGroovy.1.groovy.after @@ -1,5 +1,5 @@ class G { void test() { - test.TestPackage.bar(); + test.TestPackage.getBar(); } } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/accessorCallGroovy.kt.after b/idea/testData/intentions/convertPropertyToFunction/accessorCallGroovy.kt.after index dd01be8884b..a2f2a6731f4 100644 --- a/idea/testData/intentions/convertPropertyToFunction/accessorCallGroovy.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/accessorCallGroovy.kt.after @@ -1,3 +1,3 @@ package test -fun bar(): Int = 1 \ No newline at end of file +fun getBar(): Int = 1 \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/blockBody.kt.after b/idea/testData/intentions/convertPropertyToFunction/blockBody.kt.after index 79f0db1c604..a5e231c8303 100644 --- a/idea/testData/intentions/convertPropertyToFunction/blockBody.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/blockBody.kt.after @@ -1,9 +1,9 @@ class A(val n: Int) { - fun foo(): Boolean { + fun getFoo(): Boolean { return n > 1 } } fun test() { - val t = A(1).foo() + val t = A(1).getFoo() } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/expressionBody.kt.after b/idea/testData/intentions/convertPropertyToFunction/expressionBody.kt.after index d66ba045b03..36b7e2cb89e 100644 --- a/idea/testData/intentions/convertPropertyToFunction/expressionBody.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/expressionBody.kt.after @@ -1,7 +1,7 @@ class A(val n: Int) { - fun foo(): Boolean = n > 1 + fun getFoo(): Boolean = n > 1 } fun test() { - val t = A(1).foo() + val t = A(1).getFoo() } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/initializer.kt.after b/idea/testData/intentions/convertPropertyToFunction/initializer.kt.after index d66ba045b03..36b7e2cb89e 100644 --- a/idea/testData/intentions/convertPropertyToFunction/initializer.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/initializer.kt.after @@ -1,7 +1,7 @@ class A(val n: Int) { - fun foo(): Boolean = n > 1 + fun getFoo(): Boolean = n > 1 } fun test() { - val t = A(1).foo() + val t = A(1).getFoo() } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.1.java b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.1.java index 13eb4e04b39..4659b79da93 100644 --- a/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.1.java +++ b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.1.java @@ -1,9 +1,7 @@ import test.O; -import static test.O.foo; class J { void test() { int n = O.foo; - int m = foo; } } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.1.java.after b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.1.java.after index 8d11a8555b2..02661d29492 100644 --- a/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.1.java.after +++ b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.1.java.after @@ -1,9 +1,7 @@ import test.O; -import static test.O.foo; class J { void test() { - int n = O.foo(); - int m = foo(); + int n = O.getFoo(); } } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.2.java b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.2.java new file mode 100644 index 00000000000..fa0009c0df0 --- /dev/null +++ b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.2.java @@ -0,0 +1,7 @@ +import static test.O.foo; + +class J { + void test() { + int m = foo; + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.2.java.after b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.2.java.after new file mode 100644 index 00000000000..ddca1f17f66 --- /dev/null +++ b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.2.java.after @@ -0,0 +1,7 @@ +import static test.O.foo; + +class J { + void test() { + int m = getFoo(); + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.kt.after b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.kt.after index 337652388ca..77dd82b3231 100644 --- a/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/javaUsageAsField.kt.after @@ -1,5 +1,5 @@ package test object O { - fun foo(): Int = 1 + fun getFoo(): Int = 1 } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/javaUsages.1.java.after b/idea/testData/intentions/convertPropertyToFunction/javaUsages.1.java.after index 9512eecc61a..3f3fbb5e085 100644 --- a/idea/testData/intentions/convertPropertyToFunction/javaUsages.1.java.after +++ b/idea/testData/intentions/convertPropertyToFunction/javaUsages.1.java.after @@ -1,7 +1,7 @@ -import static test.TestPackage.foo; +import static test.TestPackage.getFoo; class J { void test() { - boolean b = foo(); + boolean b = getFoo(); } } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/javaUsages.kt.after b/idea/testData/intentions/convertPropertyToFunction/javaUsages.kt.after index e3ea93fedd8..13802287db1 100644 --- a/idea/testData/intentions/convertPropertyToFunction/javaUsages.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/javaUsages.kt.after @@ -1,3 +1,3 @@ package test -fun foo(): Boolean = true \ No newline at end of file +fun getFoo(): Boolean = true \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/otherRefs.kt.after b/idea/testData/intentions/convertPropertyToFunction/otherRefs.kt.after index bdd3a5a44b2..1d845e5f8ee 100644 --- a/idea/testData/intentions/convertPropertyToFunction/otherRefs.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/otherRefs.kt.after @@ -1,12 +1,12 @@ // WITH_RUNTIME package p -import p.foo +import p.getFoo class A(val n: Int) -fun A.foo(): Boolean = n > 1 +fun A.getFoo(): Boolean = n > 1 fun test() { - val t = A::foo + val t = A::getFoo } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/overrides.1.java.after b/idea/testData/intentions/convertPropertyToFunction/overrides.1.java.after index 93392d4ed19..19afcd39834 100644 --- a/idea/testData/intentions/convertPropertyToFunction/overrides.1.java.after +++ b/idea/testData/intentions/convertPropertyToFunction/overrides.1.java.after @@ -6,14 +6,14 @@ class JA extends A { } @Override - boolean foo() { + boolean getFoo() { return true; } } class JTest { void test() { - boolean x = new A(1).foo(); - boolean y = new JA().foo(); + boolean x = new A(1).getFoo(); + boolean y = new JA().getFoo(); } } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/overrides.kt.after b/idea/testData/intentions/convertPropertyToFunction/overrides.kt.after index 0a693bd44d8..c10c7ed4ac2 100644 --- a/idea/testData/intentions/convertPropertyToFunction/overrides.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/overrides.kt.after @@ -1,18 +1,18 @@ package test interface T { - fun foo(): Boolean + fun getFoo(): Boolean } open class A(val n: Int): T { - override fun foo(): Boolean = n > 1 + override fun getFoo(): Boolean = n > 1 } class B: A(1) { - override fun foo(): Boolean = true + override fun getFoo(): Boolean = true } fun test() { - val a = A(1).foo() - val b = B().foo() + val a = A(1).getFoo() + val b = B().getFoo() } \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/recursiveAccessor.kt.after b/idea/testData/intentions/convertPropertyToFunction/recursiveAccessor.kt.after index d6bf935514b..77f4064bfb6 100644 --- a/idea/testData/intentions/convertPropertyToFunction/recursiveAccessor.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/recursiveAccessor.kt.after @@ -1,2 +1,2 @@ // WITH_RUNTIME -fun String.foo(): String = if (isEmpty()) "" else substring(1).foo() \ No newline at end of file +fun String.getFoo(): String = if (isEmpty()) "" else substring(1).getFoo() \ No newline at end of file diff --git a/idea/testData/intentions/convertPropertyToFunction/unchangedElements.kt.after b/idea/testData/intentions/convertPropertyToFunction/unchangedElements.kt.after index 9783d9c2629..9fa0cbe7a6a 100644 --- a/idea/testData/intentions/convertPropertyToFunction/unchangedElements.kt.after +++ b/idea/testData/intentions/convertPropertyToFunction/unchangedElements.kt.after @@ -3,11 +3,11 @@ annotation class X(val s: String) class A(val n: Int) { - internal X("1") fun T.foo(): Boolean = toInt() - n > 1 + internal X("1") fun T.getFoo(): Boolean = toInt() - n > 1 } fun test() { val t = with(A(1)) { - 2.5.foo() + 2.5.getFoo() } } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index 69f5ca6e2ec..1adde2d43e8 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -3217,6 +3217,18 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } + @TestMetadata("javaUsagesGet.kt") + public void testJavaUsagesGet() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertFunctionToProperty/javaUsagesGet.kt"); + doTest(fileName); + } + + @TestMetadata("javaUsagesIs.kt") + public void testJavaUsagesIs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertFunctionToProperty/javaUsagesIs.kt"); + doTest(fileName); + } + @TestMetadata("localFun.kt") public void testLocalFun() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertFunctionToProperty/localFun.kt"); @@ -3235,6 +3247,18 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } + @TestMetadata("otherRefsGet.kt") + public void testOtherRefsGet() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertFunctionToProperty/otherRefsGet.kt"); + doTest(fileName); + } + + @TestMetadata("otherRefsIs.kt") + public void testOtherRefsIs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertFunctionToProperty/otherRefsIs.kt"); + doTest(fileName); + } + @TestMetadata("overrides.kt") public void testOverrides() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertFunctionToProperty/overrides.kt");