Convert member to extension: do not suggest for delegated properties

#KT-35128 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-11-28 23:44:43 +09:00
committed by Nikita Bobko
parent 46fccae7d1
commit c91858d470
3 changed files with 11 additions and 1 deletions
@@ -50,7 +50,7 @@ class ConvertMemberToExtensionIntention : SelfTargetingRangeIntention<KtCallable
if (element.receiverTypeReference != null) return false
if (element.hasModifier(KtTokens.OVERRIDE_KEYWORD)) return false
when (element) {
is KtProperty -> if (element.hasInitializer()) return false
is KtProperty -> if (element.hasInitializer() || element.hasDelegate()) return false
is KtSecondaryConstructor -> return false
}
@@ -0,0 +1,5 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
open class XdProject {
val haha<caret>: String by lazy { "gogog" }
}
@@ -8282,6 +8282,11 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/intentions/declarations/convertMemberToExtension"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), null, true);
}
@TestMetadata("delegatedProperty.kt")
public void testDelegatedProperty() throws Exception {
runTest("idea/testData/intentions/declarations/convertMemberToExtension/delegatedProperty.kt");
}
@TestMetadata("explicitUnit.kt")
public void testExplicitUnit() throws Exception {
runTest("idea/testData/intentions/declarations/convertMemberToExtension/explicitUnit.kt");