Convert member to extension: do not suggest for delegated properties
#KT-35128 Fixed
This commit is contained in:
committed by
Nikita Bobko
parent
46fccae7d1
commit
c91858d470
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user