diff --git a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateKotlinCallableAction.kt b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateKotlinCallableAction.kt index d54080b71f6c..b260cb5f3cfc 100644 --- a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateKotlinCallableAction.kt +++ b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateKotlinCallableAction.kt @@ -87,7 +87,7 @@ internal class CreateKotlinCallableAction( require(call != null) CreateKotlinCallablePsiEditor( project, pointerToContainer, callableInfo, - ).execute(call) + ).execute(call, request) } } @@ -120,10 +120,9 @@ internal class CreateKotlinCallableAction( context (KtAnalysisSession) private fun renderTypeName(expectedType: ExpectedType, container: KtElement): String? { - val returnKtType = if (expectedType is ExpectedKotlinType) expectedType.ktType else expectedType.toKtTypeWithNullability(container) - if (returnKtType == null || returnKtType == builtinTypes.UNIT) return null - if (!isAccessibleInCreationPlace(returnKtType, (request as? CreateMethodFromKotlinUsageRequest)?.call)) return null - return returnKtType.render(renderer = WITH_TYPE_NAMES_FOR_CREATE_ELEMENTS, position = Variance.INVARIANT) + val ktType = if (expectedType is ExpectedKotlinType) expectedType.ktType else expectedType.toKtTypeWithNullability(container) + if (ktType == null || ktType == builtinTypes.UNIT) return null + return ktType.render(renderer = WITH_TYPE_NAMES_FOR_CREATE_ELEMENTS, position = Variance.INVARIANT) } private fun buildCallableAsString(): String? { diff --git a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateKotlinCallablePsiEditor.kt b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateKotlinCallablePsiEditor.kt index 1b50392b4b69..49ed572e259e 100644 --- a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateKotlinCallablePsiEditor.kt +++ b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateKotlinCallablePsiEditor.kt @@ -8,6 +8,7 @@ import com.intellij.codeInsight.template.TemplateEditingAdapter import com.intellij.codeInsight.template.TemplateManager import com.intellij.codeInsight.template.impl.TemplateImpl import com.intellij.ide.util.EditorHelper +import com.intellij.lang.jvm.actions.CreateMethodRequest import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.RangeMarker @@ -54,7 +55,7 @@ internal class CreateKotlinCallablePsiEditor( private val pointerToContainer: SmartPsiElementPointer<*>, private val callableInfo: NewCallableInfo, ) { - fun execute(anchor: PsiElement) { + fun execute(anchor: PsiElement, request: CreateMethodRequest) { val factory = KtPsiFactory(project) var function = factory.createFunction(callableInfo.definitionAsString) val passedContainerElement = pointerToContainer.element @@ -67,13 +68,26 @@ internal class CreateKotlinCallablePsiEditor( passedContainerElement } - val containerMaybeCompanion = if (insertContainer is KtClass && callableInfo.isForCompanion) { - insertContainer.getOrCreateCompanionObject() - } else insertContainer + val containerMaybeCompanion = if (callableInfo.isForCompanion) { + if (insertContainer is KtClass) { + insertContainer.getOrCreateCompanionObject() + } else { + val targetClass = (request as? CreateMethodFromKotlinUsageRequest)?.targetClass + val ktClass = targetClass as? KtClass + if (ktClass != null) { + val hasCompanionObject = ktClass.companionObjects.isNotEmpty() + val companion = ktClass.getOrCreateCompanionObject() + if (!hasCompanionObject && request.isExtension) { + companion.body?.delete() + } + } + insertContainer + } + } + else insertContainer function = CreateFromUsageUtil.placeDeclarationInContainer(function, containerMaybeCompanion, anchor) - //function = function.addToContainer(container) as? KtNamedFunction ?: return function = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(function) ?: return runTemplate(function) } diff --git a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateMethodFromKotlinUsageRequest.kt b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateMethodFromKotlinUsageRequest.kt index 4ce9e3c8f274..169fbb2f4544 100644 --- a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateMethodFromKotlinUsageRequest.kt +++ b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/CreateMethodFromKotlinUsageRequest.kt @@ -6,7 +6,9 @@ import com.intellij.lang.jvm.actions.CreateMethodRequest import com.intellij.lang.jvm.actions.ExpectedType import com.intellij.lang.jvm.types.JvmReferenceType import com.intellij.openapi.util.NlsSafe +import com.intellij.psi.PsiElement import org.jetbrains.kotlin.analysis.api.analyze +import org.jetbrains.kotlin.analysis.api.symbols.KtClassLikeSymbol import org.jetbrains.kotlin.analysis.api.types.KtType import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtExpression @@ -22,8 +24,16 @@ internal class CreateMethodFromKotlinUsageRequest ( val receiverType: KtType?, // (in case receiverExpression is null) it can be notnull when there's implicit receiver: `blah { unknownFunc() }` val isExtension: Boolean, val isAbstractClassOrInterface: Boolean, - val isForCompanion: Boolean + val isForCompanion: Boolean, ) : CreateExecutableFromKotlinUsageRequest(functionCall, modifiers), CreateMethodRequest { + internal val targetClass: PsiElement? = initializeTargetClass(receiverExpression, functionCall) + + private fun initializeTargetClass(receiverExpression: KtExpression?, functionCall: KtCallExpression): PsiElement? { + return analyze(functionCall) { + (receiverExpression?.resolveExpression() as? KtClassLikeSymbol)?.psi + } + } + private val returnType:List = initializeReturnType(functionCall) private fun initializeReturnType(functionCall: KtCallExpression): List { diff --git a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/KotlinElementActionsFactory.kt b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/KotlinElementActionsFactory.kt index cc20e57401a6..a384f43f5d32 100644 --- a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/KotlinElementActionsFactory.kt +++ b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/KotlinElementActionsFactory.kt @@ -7,29 +7,14 @@ import com.intellij.lang.jvm.JvmClass import com.intellij.lang.jvm.actions.CreateMethodRequest import com.intellij.lang.jvm.actions.JvmElementActionsFactory import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade -import org.jetbrains.kotlin.asJava.elements.KtLightElement import org.jetbrains.kotlin.idea.base.resources.KotlinBundle import org.jetbrains.kotlin.idea.refactoring.isAbstract import org.jetbrains.kotlin.idea.refactoring.isInterfaceClass import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer class KotlinElementActionsFactory : JvmElementActionsFactory() { - private fun JvmClass.toKtClassOrFile(): KtElement? = if (this is JvmClassWrapperForKtClass<*>) { - ktClassOrFile - } else { - when (val psi = sourceElement) { - is KtClassOrObject -> psi - is KtLightClassForFacade -> psi.files.firstOrNull() - is KtLightElement<*, *> -> psi.kotlinOrigin - is KtFile -> psi - else -> null - } - } - override fun createAddMethodActions(targetClass: JvmClass, request: CreateMethodRequest): List { if (targetClass is PsiElement && !BaseIntentionAction.canModify(targetClass)) return emptyList() var container = targetClass.toKtClassOrFile() ?: return emptyList() diff --git a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/Utils.kt b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/Utils.kt index 97aea1cea297..17c71206b52c 100644 --- a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/Utils.kt +++ b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/Utils.kt @@ -30,6 +30,8 @@ import org.jetbrains.kotlin.analysis.api.symbols.* import org.jetbrains.kotlin.analysis.api.types.* import org.jetbrains.kotlin.analysis.api.types.KtIntersectionType import org.jetbrains.kotlin.analysis.utils.printer.PrettyPrinter +import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade +import org.jetbrains.kotlin.asJava.elements.KtLightElement import org.jetbrains.kotlin.asJava.findFacadeClass import org.jetbrains.kotlin.asJava.toLightClass import org.jetbrains.kotlin.idea.base.codeInsight.KotlinNameSuggester @@ -106,6 +108,9 @@ internal fun KtElement.getExpectedKotlinType(): ExpectedType? { } } if (expectedType == null) return null + if (!isAccessibleInCreationPlace(expectedType, this)) { + return null + } val jvmType = expectedType.convertToJvmType(this) ?: return null return ExpectedKotlinType(expectedType, jvmType) } @@ -287,10 +292,24 @@ fun isAccessibleInCreationPlace(ktType: KtType, call: KtElement?): Boolean { // having ` caller(T t) { unknownMethod(t); }` the type `T` is not accessible in created method unknownMethod(t) val owner = (ktLeaf.symbol.psi as? KtTypeParameter)?.getOwningTypeParameterOwner() // todo must have been "insertion point" instead of `call` - owner == null || PsiTreeUtil.isAncestor(owner, call, false) + if (owner == null) true + else if (owner is KtCallableDeclaration) false + else PsiTreeUtil.isAncestor(owner, call, false) } else { // KtErrorType means this type is unresolved in the context of container ktLeaf !is KtErrorType } } } + +fun JvmClass.toKtClassOrFile(): KtElement? = if (this is JvmClassWrapperForKtClass<*>) { + ktClassOrFile +} else { + when (val psi = sourceElement) { + is KtClassOrObject -> psi + is KtLightClassForFacade -> psi.files.firstOrNull() + is KtLightElement<*, *> -> psi.kotlinOrigin + is KtFile -> psi + else -> null + } +} diff --git a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/createKotlinCallableFromUsage.kt b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/createKotlinCallableFromUsage.kt index ba136458e108..a42214c7c03f 100644 --- a/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/createKotlinCallableFromUsage.kt +++ b/plugins/kotlin/code-insight/kotlin.code-insight.k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/quickFixes/createFromUsage/createKotlinCallableFromUsage.kt @@ -97,7 +97,7 @@ internal fun buildRequests(callExpression: KtCallExpression): List() ?: calleeExpression.containingKtFile val jvmClassWrapper = JvmClassWrapperForKtClass(containerClassForExtension) - val modifiers = computeModifiers(defaultContainerPsi?:calleeExpression.containingFile, calleeExpression, callExpression, false, true) + val shouldCreateCompanionClass = shouldCreateCompanionClass(calleeExpression) + val modifiers = computeModifiers(defaultContainerPsi?:calleeExpression.containingFile, calleeExpression, callExpression, shouldCreateCompanionClass, true) requests.add(jvmClassWrapper to CreateMethodFromKotlinUsageRequest( callExpression, modifiers, @@ -115,7 +116,7 @@ internal fun buildRequests(callExpression: KtCallExpression): List { if (shouldCreateCompanionClass) { - return listOf(JvmModifier.PUBLIC, JvmModifier.STATIC) // methods in the companion class are typically public (and static in case of java) + // methods in the companion class are typically public (and static in case of java) + return if (samePackage(calleeExpression, callExpression)) if (isExtension) listOf(JvmModifier.PRIVATE, JvmModifier.STATIC) else listOf(JvmModifier.STATIC) else listOf(JvmModifier.PUBLIC, JvmModifier.STATIC) } val modifier = CreateFromUsageUtil.patchVisibilityForInlineFunction(callExpression) if (modifier != null) { return listOf(allModifiers[modifier]!!) } val modifierOwner = callExpression.getNonStrictParentOfType() - val packageNameOfReceiver = calleeExpression.getReceiverOrContainerClassPackageName() - if (modifierOwner != null && packageNameOfReceiver != null && packageNameOfReceiver != callExpression.containingKtFile.packageFqName) { + val samePackage = samePackage(calleeExpression, callExpression) + if (modifierOwner != null && !samePackage) { for (entry in allModifiers) { if (modifierOwner.hasModifier(entry.key)) { return listOf(entry.value) @@ -175,6 +177,17 @@ private fun computeModifiers( return listOf(JvmModifier.PUBLIC) } + +context (KtAnalysisSession) +private fun samePackage( + calleeExpression: KtSimpleNameExpression, + callExpression: KtCallExpression +): Boolean { + val packageNameOfReceiver = calleeExpression.getReceiverOrContainerClassPackageName() + val samePackage = packageNameOfReceiver != null && packageNameOfReceiver == callExpression.containingKtFile.packageFqName + return samePackage +} + /** * Returns the type of the class containing this [KtSimpleNameExpression] if the class is abstract. Otherwise, returns null. */ diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateAnonymousObjectRuntime.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateAnonymousObjectRuntime.kt index dfa96e6aa7bd..e08351a4596b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateAnonymousObjectRuntime.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateAnonymousObjectRuntime.kt @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateAnonymousObjectRuntime.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateAnonymousObjectRuntime.kt.after index 26e01f81f8bf..f86a83654acc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateAnonymousObjectRuntime.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateAnonymousObjectRuntime.kt.after @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateLocalClassRuntime.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateLocalClassRuntime.kt index ec35a61b0301..b16d74b81474 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateLocalClassRuntime.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateLocalClassRuntime.kt @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateLocalClassRuntime.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateLocalClassRuntime.kt.after index 39be20400408..194317467576 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateLocalClassRuntime.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/approximateLocalClassRuntime.kt.after @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extension.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extension.kt index ffd4f6f3d9c2..653c7f9ad6b1 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extension.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extension.kt @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // WITH_STDLIB // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extension.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extension.kt.after index 1eaaa2339481..ecd6383d0cd5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extension.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extension.kt.after @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // WITH_STDLIB // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionPartialSubstitution.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionPartialSubstitution.kt index 159dccd46f0a..e2e67edba29d 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionPartialSubstitution.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionPartialSubstitution.kt @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // WITH_STDLIB // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionPartialSubstitution.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionPartialSubstitution.kt.after index 14f645f718e4..b4355f72656a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionPartialSubstitution.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionPartialSubstitution.kt.after @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // WITH_STDLIB // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionWithReceiverArg.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionWithReceiverArg.kt index f163c1467062..68cd1df30e5f 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionWithReceiverArg.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionWithReceiverArg.kt @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // WITH_STDLIB // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionWithReceiverArg.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionWithReceiverArg.kt.after index 1eaaa2339481..ecd6383d0cd5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionWithReceiverArg.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/call/extension/extensionWithReceiverArg.kt.after @@ -1,4 +1,4 @@ -// "Create extension function 'List.foo'" "true" +// "/(Create extension function 'List.foo')|(Create extension function 'List.foo')/" "true" // WITH_STDLIB // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateExtensionCallableFromUsageFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.quickFixes.createFromUsage.CreateKotlinCallableAction