diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index c785e1506e7..4334ca2d8c8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -34,7 +34,6 @@ import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.CreateClas import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.CreateClassFromConstructorCallActionFactory import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.CreateClassFromReferenceExpressionActionFactory import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.CreateClassFromTypeReferenceActionFactory -import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createTypeAlias.CreateTypeAliasFromTypeReferenceActionFactory import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createTypeParameter.CreateTypeParameterByUnresolvedRefActionFactory import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createTypeParameter.CreateTypeParameterUnmatchedTypeArgumentActionFactory import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createVariable.CreateLocalVariableActionFactory @@ -414,8 +413,6 @@ class QuickFixRegistrar : QuickFixContributor { CreateClassFromCallWithConstructorCalleeActionFactory ) - UNRESOLVED_REFERENCE.registerFactory(CreateTypeAliasFromTypeReferenceActionFactory) - UNRESOLVED_REFERENCE.registerFactory(PlatformUnresolvedProvider) PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED.registerFactory(InsertDelegationCallQuickfix.InsertThisDelegationCallFactory) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeAlias/CreateTypeAliasFromTypeReferenceActionFactory.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeAlias/CreateTypeAliasFromTypeReferenceActionFactory.kt deleted file mode 100644 index 9dabade4b4a..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeAlias/CreateTypeAliasFromTypeReferenceActionFactory.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.quickfix.createFromUsage.createTypeAlias - -import com.intellij.lang.java.JavaLanguage -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiPackage -import org.jetbrains.kotlin.config.LanguageFeature -import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.idea.core.CollectingNameValidator -import org.jetbrains.kotlin.idea.core.KotlinNameSuggester -import org.jetbrains.kotlin.idea.core.NewDeclarationNameValidator -import org.jetbrains.kotlin.idea.project.languageVersionSettings -import org.jetbrains.kotlin.idea.quickfix.IntentionActionPriority -import org.jetbrains.kotlin.idea.quickfix.KotlinSingleIntentionActionFactoryWithDelegate -import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.CreateClassFromTypeReferenceActionFactory -import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.getTypeConstraintInfo -import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.psi.KtUserType -import org.jetbrains.kotlin.psi.psiUtil.getParentOfTypeAndBranch -import org.jetbrains.kotlin.types.typeUtil.containsError - -object CreateTypeAliasFromTypeReferenceActionFactory : KotlinSingleIntentionActionFactoryWithDelegate(IntentionActionPriority.LOW) { - override fun getElementOfInterest(diagnostic: Diagnostic) = CreateClassFromTypeReferenceActionFactory.getElementOfInterest(diagnostic) - - override fun extractFixData(element: KtUserType, diagnostic: Diagnostic): TypeAliasInfo? { - if (element.getParentOfTypeAndBranch(true) { qualifier } != null) return null - if (!element.languageVersionSettings.supportsFeature(LanguageFeature.TypeAliases)) return null - - val classInfo = CreateClassFromTypeReferenceActionFactory.extractFixData(element, diagnostic) ?: return null - val targetParent = classInfo.applicableParents.singleOrNull { it !is KtDeclaration && it !is PsiPackage } ?: return null - if ((targetParent as? PsiClass)?.language == JavaLanguage.INSTANCE) return null - - val expectedType = getTypeConstraintInfo(element)?.upperBound - if (expectedType != null && expectedType.containsError()) return null - - val validator = CollectingNameValidator( - filter = NewDeclarationNameValidator(targetParent, null, NewDeclarationNameValidator.Target.FUNCTIONS_AND_CLASSES) - ) - val typeParameterNames = KotlinNameSuggester.suggestNamesForTypeParameters(classInfo.typeArguments.size, validator) - return TypeAliasInfo(classInfo.name, targetParent, typeParameterNames, expectedType) - } - - override fun createFix(originalElement: KtUserType, data: TypeAliasInfo) = CreateTypeAliasFromUsageFix(originalElement, data) -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeAlias/CreateTypeAliasFromUsageFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeAlias/CreateTypeAliasFromUsageFix.kt deleted file mode 100644 index 6ac648a9eb3..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeAlias/CreateTypeAliasFromUsageFix.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.quickfix.createFromUsage.createTypeAlias - -import com.intellij.codeInsight.intention.LowPriorityAction -import com.intellij.codeInsight.template.TemplateBuilderImpl -import com.intellij.codeInsight.template.impl.ConstantNode -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.idea.quickfix.createFromUsage.CreateFromUsageFixBase -import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.placeDeclarationInContainer -import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers -import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtPsiFactory -import org.jetbrains.kotlin.types.KotlinType - -class TypeAliasInfo( - val name: String, - val targetParent: PsiElement, - val typeParameterNames: List, - val expectedType: KotlinType? -) - -class CreateTypeAliasFromUsageFix( - element: E, - private val aliasInfo: TypeAliasInfo -) : CreateFromUsageFixBase(element), LowPriorityAction { - override fun getText() = "Create type alias '${aliasInfo.name}'" - - override fun invoke(project: Project, editor: Editor?, file: KtFile) { - val element = element ?: return - if (editor == null) return - - val typeAliasProto = KtPsiFactory(project).createTypeAlias(aliasInfo.name, aliasInfo.typeParameterNames, "Dummy") - val typeAlias = placeDeclarationInContainer(typeAliasProto, aliasInfo.targetParent, element) - - if (!ApplicationManager.getApplication().isUnitTestMode) { - PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.document) - - val aliasBody = typeAlias.getTypeReference()!! - - with(TemplateBuilderImpl(typeAlias)) { - for ((typeParameter, typeParameterName) in (typeAlias.typeParameters zip aliasInfo.typeParameterNames)) { - replaceElement(typeParameter, ConstantNode(typeParameterName)) - } - val defaultBodyText = aliasInfo.expectedType?.let { IdeDescriptorRenderers.SOURCE_CODE.renderType(it) } ?: "Any" - replaceElement(aliasBody, ConstantNode(defaultBodyText)) - - run(editor, true) - } - } - } -} diff --git a/idea/testData/multiModuleQuickFix/importExpectClassWithoutActualInJvm/jvm/b.kt b/idea/testData/multiModuleQuickFix/importExpectClassWithoutActualInJvm/jvm/b.kt index 79522e0538f..241d17151bf 100644 --- a/idea/testData/multiModuleQuickFix/importExpectClassWithoutActualInJvm/jvm/b.kt +++ b/idea/testData/multiModuleQuickFix/importExpectClassWithoutActualInJvm/jvm/b.kt @@ -3,7 +3,6 @@ // ACTION: Create class 'Foo' // ACTION: Create enum 'Foo' // ACTION: Create interface 'Foo' -// ACTION: Create type alias 'Foo' // ACTION: Create type parameter 'Foo' in function 'use' // ERROR: Unresolved reference: Foo package bar diff --git a/idea/testData/multiModuleQuickFix/importExpectClassWithoutActualInJvm/jvm/b.kt.after b/idea/testData/multiModuleQuickFix/importExpectClassWithoutActualInJvm/jvm/b.kt.after index 1f53cb5b763..c0dfe6a4c40 100644 --- a/idea/testData/multiModuleQuickFix/importExpectClassWithoutActualInJvm/jvm/b.kt.after +++ b/idea/testData/multiModuleQuickFix/importExpectClassWithoutActualInJvm/jvm/b.kt.after @@ -3,7 +3,6 @@ // ACTION: Create class 'Foo' // ACTION: Create enum 'Foo' // ACTION: Create interface 'Foo' -// ACTION: Create type alias 'Foo' // ACTION: Create type parameter 'Foo' in function 'use' // ERROR: Unresolved reference: Foo package bar diff --git a/idea/testData/quickfix/autoImports/noImportInQualifiedUserTypeNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInQualifiedUserTypeNotFirst.before.Main.kt index 31302dca8db..0d187168fbf 100644 --- a/idea/testData/quickfix/autoImports/noImportInQualifiedUserTypeNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportInQualifiedUserTypeNotFirst.before.Main.kt @@ -1,6 +1,5 @@ // "class org.jetbrains.kotlin.idea.quickfix.ImportFix" "false" // ACTION: Create interface 'SomeTest' -// ACTION: Create type alias 'SomeTest' // ERROR: Unresolved reference: SomeTest package testing diff --git a/idea/testData/quickfix/createFromUsage/createClass/delegationSpecifier/classDelegatorToSuperclass.kt b/idea/testData/quickfix/createFromUsage/createClass/delegationSpecifier/classDelegatorToSuperclass.kt index 9d76c6bd421..755e08f9975 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/delegationSpecifier/classDelegatorToSuperclass.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/delegationSpecifier/classDelegatorToSuperclass.kt @@ -1,6 +1,5 @@ // "Create class 'A'" "false" // ACTION: Create interface 'A' -// ACTION: Create type alias 'A' // ACTION: Create type parameter 'A' in class 'Foo' // ACTION: Create test // ERROR: Unresolved reference: A diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/annotationNotQualifierWithTypeArgs.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/annotationNotQualifierWithTypeArgs.kt index 44873710b0b..bfe5ee6eb24 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/annotationNotQualifierWithTypeArgs.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/annotationNotQualifierWithTypeArgs.kt @@ -1,7 +1,6 @@ // "Create annotation 'A'" "false" // ACTION: Create class 'A' // ACTION: Create interface 'A' -// ACTION: Create type alias 'A' // ACTION: Convert to block body // ACTION: Remove explicit type specification // ERROR: Unresolved reference: A diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/enumEntryNotQualifierNoTypeArgs.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/enumEntryNotQualifierNoTypeArgs.kt index bc3e75fbac5..3d0a911f178 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/enumEntryNotQualifierNoTypeArgs.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/enumEntryNotQualifierNoTypeArgs.kt @@ -3,7 +3,6 @@ // ACTION: Create class 'A' // ACTION: Create interface 'A' // ACTION: Create enum 'A' -// ACTION: Create type alias 'A' // ACTION: Convert to block body // ACTION: Remove explicit type specification // ACTION: Create type parameter 'A' in function 'foo' diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/enumNotQualifierWithTypeArgs.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/enumNotQualifierWithTypeArgs.kt index 91c5411e9e5..6fc187b6373 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/enumNotQualifierWithTypeArgs.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/enumNotQualifierWithTypeArgs.kt @@ -1,7 +1,6 @@ // "Create enum 'A'" "false" // ACTION: Create class 'A' // ACTION: Create interface 'A' -// ACTION: Create type alias 'A' // ACTION: Convert to block body // ACTION: Remove explicit type specification // ERROR: Unresolved reference: A diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noAnnotationForTypeBound.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noAnnotationForTypeBound.kt index 1477d268b2f..6f80b94d907 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noAnnotationForTypeBound.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noAnnotationForTypeBound.kt @@ -1,7 +1,6 @@ // "Create annotation 'NotExistent'" "false" // ACTION: Create class 'NotExistent' // ACTION: Create interface 'NotExistent' -// ACTION: Create type alias 'NotExistent' // ACTION: Create type parameter 'NotExistent' in class 'TPB' // ACTION: Create test // ERROR: Unresolved reference: NotExistent diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noAnnotationForTypeConstraint.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noAnnotationForTypeConstraint.kt index 80d95154862..c34ef1d6107 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noAnnotationForTypeConstraint.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noAnnotationForTypeConstraint.kt @@ -1,7 +1,6 @@ // "Create annotation 'NotExistent'" "false" // ACTION: Create class 'NotExistent' // ACTION: Create interface 'NotExistent' -// ACTION: Create type alias 'NotExistent' // ACTION: Create type parameter 'NotExistent' in class 'TPB' // ACTION: Create test // ERROR: Unresolved reference: NotExistent diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noEnumForTypeBound.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noEnumForTypeBound.kt index 30eea9137d7..56cbf3915d4 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noEnumForTypeBound.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noEnumForTypeBound.kt @@ -1,7 +1,6 @@ // "Create enum 'NotExistent'" "false" // ACTION: Create class 'NotExistent' // ACTION: Create interface 'NotExistent' -// ACTION: Create type alias 'NotExistent' // ACTION: Create type parameter 'NotExistent' in class 'TPB' // ACTION: Create test // ERROR: Unresolved reference: NotExistent diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noEnumForTypeConstraint.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noEnumForTypeConstraint.kt index e074568c2d1..5e8f1331309 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noEnumForTypeConstraint.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noEnumForTypeConstraint.kt @@ -1,7 +1,6 @@ // "Create enum 'NotExistent'" "false" // ACTION: Create class 'NotExistent' // ACTION: Create interface 'NotExistent' -// ACTION: Create type alias 'NotExistent' // ACTION: Create type parameter 'NotExistent' in class 'TPB' // ACTION: Create test // ERROR: Unresolved reference: NotExistent diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noObjectForTypeBound.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noObjectForTypeBound.kt index 4d60bcddd64..ada91a16955 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noObjectForTypeBound.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noObjectForTypeBound.kt @@ -1,7 +1,6 @@ // "Create object 'NotExistent'" "false" // ACTION: Create class 'NotExistent' // ACTION: Create interface 'NotExistent' -// ACTION: Create type alias 'NotExistent' // ACTION: Create type parameter 'NotExistent' in class 'TPB' // ACTION: Create test // ERROR: Unresolved reference: NotExistent diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noObjectForTypeConstraint.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noObjectForTypeConstraint.kt index ae4d4983281..7dcec3250da 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/noObjectForTypeConstraint.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/noObjectForTypeConstraint.kt @@ -1,7 +1,6 @@ // "Create object 'NotExistent'" "false" // ACTION: Create class 'NotExistent' // ACTION: Create interface 'NotExistent' -// ACTION: Create type alias 'NotExistent' // ACTION: Create type parameter 'NotExistent' in class 'TPB' // ACTION: Create test // ERROR: Unresolved reference: NotExistent diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/objectNotQualifierNoTypeArgs.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/objectNotQualifierNoTypeArgs.kt index 3a6aac643e0..dfc09a469bb 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/objectNotQualifierNoTypeArgs.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/objectNotQualifierNoTypeArgs.kt @@ -3,7 +3,6 @@ // ACTION: Create class 'A' // ACTION: Create interface 'A' // ACTION: Create enum 'A' -// ACTION: Create type alias 'A' // ACTION: Convert to block body // ACTION: Remove explicit type specification // ACTION: Create type parameter 'A' in function 'foo' diff --git a/idea/testData/quickfix/createFromUsage/createClass/typeReference/objectNotQualifierWithTypeArgs.kt b/idea/testData/quickfix/createFromUsage/createClass/typeReference/objectNotQualifierWithTypeArgs.kt index fd0c74d5a39..edbc437c6d4 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/typeReference/objectNotQualifierWithTypeArgs.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/typeReference/objectNotQualifierWithTypeArgs.kt @@ -1,7 +1,6 @@ // "Create object 'A'" "false" // ACTION: Create class 'A' // ACTION: Create interface 'A' -// ACTION: Create type alias 'A' // ACTION: Convert to block body // ACTION: Remove explicit type specification // ERROR: Unresolved reference: A diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/currentPackageReceiver.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/currentPackageReceiver.kt deleted file mode 100644 index 3fed3884087..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/currentPackageReceiver.kt +++ /dev/null @@ -1,5 +0,0 @@ -// "Create type alias 'A'" "true" -// ERROR: Unresolved reference: Dummy -package p - -fun foo(): p.A = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/currentPackageReceiver.kt.after b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/currentPackageReceiver.kt.after deleted file mode 100644 index a8ee2dd1b6e..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/currentPackageReceiver.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Create type alias 'A'" "true" -// ERROR: Unresolved reference: Dummy -package p - -typealias A = Dummy - -fun foo(): p.A = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/javaUserTypeReceiver.test b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/javaUserTypeReceiver.test deleted file mode 100644 index 96836dd6102..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/javaUserTypeReceiver.test +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: foo/test.before.kt -// "Create type alias 'A'" "false" -// ACTION: Convert to block body -// ACTION: Create annotation 'A' -// ACTION: Create class 'A' -// ACTION: Create enum 'A' -// ACTION: Create interface 'A' -// ACTION: Remove explicit type specification -// ERROR: Unresolved reference: A -package foo - -fun foo(): JavaClass.A = throw Throwable("") - - -// FILE: foo/JavaClass.java -package foo; - -public class JavaClass { -} diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/libTypeReceiver.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/libTypeReceiver.kt deleted file mode 100644 index b1e17fee2ab..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/libTypeReceiver.kt +++ /dev/null @@ -1,7 +0,0 @@ -// "Create type alias 'A'" "false" -// ACTION: Convert to block body -// ACTION: Remove explicit type specification -// ERROR: Unresolved reference: A -package p - -internal fun foo(): Int.A = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefNoBody.kt.after b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefNoBody.kt.after deleted file mode 100644 index 66b3fc041a6..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefNoBody.kt.after +++ /dev/null @@ -1,6 +0,0 @@ -// "Create type alias 'X'" "true" -open class A - -class B : A() { - typealias X = Dummy -} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefNoBody.kt_ignore b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefNoBody.kt_ignore deleted file mode 100644 index 0343f13e1d7..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefNoBody.kt_ignore +++ /dev/null @@ -1,5 +0,0 @@ -// DISABLED: See KT-13596 -// "Create type alias 'X'" "true" -open class A - -class B : AX>() \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefWithBody.kt.after b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefWithBody.kt.after deleted file mode 100644 index 600329a7498..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefWithBody.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Create type alias 'X'" "true" -open class A - -class B : A() { - typealias X = Dummy - -} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefWithBody.kt_ignore b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefWithBody.kt_ignore deleted file mode 100644 index da4dc51fcd0..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/nestedClassByTypeArgumentRefWithBody.kt_ignore +++ /dev/null @@ -1,7 +0,0 @@ -// DISABLED: See KT-13596 -// "Create type alias 'X'" "true" -open class A - -class B : AX>() { - -} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierNoTypeArgs.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierNoTypeArgs.kt deleted file mode 100644 index 023d03c7ca3..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierNoTypeArgs.kt +++ /dev/null @@ -1,5 +0,0 @@ -// "Create type alias 'A'" "true" -// ERROR: Unresolved reference: Dummy -package p - -fun foo(): A = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierNoTypeArgs.kt.after b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierNoTypeArgs.kt.after deleted file mode 100644 index 400381c12dd..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierNoTypeArgs.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Create type alias 'A'" "true" -// ERROR: Unresolved reference: Dummy -package p - -typealias A = Dummy - -fun foo(): A = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithStarProjection.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithStarProjection.kt deleted file mode 100644 index f8851afebd2..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithStarProjection.kt +++ /dev/null @@ -1,5 +0,0 @@ -// "Create type alias 'A'" "true" -// ERROR: Unresolved reference: Dummy -package p - -fun foo(): A<*, String> = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithStarProjection.kt.after b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithStarProjection.kt.after deleted file mode 100644 index b08210b1bdb..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithStarProjection.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Create type alias 'A'" "true" -// ERROR: Unresolved reference: Dummy -package p - -typealias A = Dummy - -fun foo(): A<*, String> = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithTypeArgs.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithTypeArgs.kt deleted file mode 100644 index 8c7ce7fa128..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithTypeArgs.kt +++ /dev/null @@ -1,5 +0,0 @@ -// "Create type alias 'A'" "true" -// ERROR: Unresolved reference: Dummy -package p - -fun foo(): A = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithTypeArgs.kt.after b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithTypeArgs.kt.after deleted file mode 100644 index 71a6c115e6c..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithTypeArgs.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Create type alias 'A'" "true" -// ERROR: Unresolved reference: Dummy -package p - -typealias A = Dummy - -fun foo(): A = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/qualifierNoTypeArgs.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/qualifierNoTypeArgs.kt deleted file mode 100644 index 8c09bb4c9be..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/qualifierNoTypeArgs.kt +++ /dev/null @@ -1,11 +0,0 @@ -// "Create type alias 'A'" "false" -// ACTION: Convert to block body -// ACTION: Create class 'A' -// ACTION: Create enum 'A' -// ACTION: Create interface 'A' -// ACTION: Create object 'A' -// ACTION: Remove explicit type specification -// ERROR: Unresolved reference: A -package p - -fun foo(): A.B = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/recursiveTypeBound1.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/recursiveTypeBound1.kt deleted file mode 100644 index 287d1525780..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/recursiveTypeBound1.kt +++ /dev/null @@ -1,11 +0,0 @@ -// "Create type alias 'X'" "false" -// ACTION: Create class 'X' -// ACTION: Create interface 'X' -// ERROR: Unresolved reference: X -package p - -open class A> - -fun foo(a: A<X>) { - -} diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/recursiveTypeBound2.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/recursiveTypeBound2.kt deleted file mode 100644 index 8e5b8b3fc2c..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/recursiveTypeBound2.kt +++ /dev/null @@ -1,11 +0,0 @@ -// "Create type alias 'X'" "false" -// ACTION: Create class 'X' -// ACTION: Create interface 'X' -// ERROR: Unresolved reference: X -package p - -open class A> - -fun foo(a: A, X>) { - -} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/typeParameterDependency.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/typeParameterDependency.kt deleted file mode 100644 index 1dd7fc0099a..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/typeParameterDependency.kt +++ /dev/null @@ -1,9 +0,0 @@ -// "Create type alias 'X'" "true" -// ERROR: Unresolved reference: Dummy -package p - -open class A> - -fun foo(a: A, X>) { - -} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/typeParameterDependency.kt.after b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/typeParameterDependency.kt.after deleted file mode 100644 index 25ff0b7ab7b..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/typeParameterDependency.kt.after +++ /dev/null @@ -1,11 +0,0 @@ -// "Create type alias 'X'" "true" -// ERROR: Unresolved reference: Dummy -package p - -open class A> - -typealias X = Dummy - -fun foo(a: A, X>) { - -} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/userTypeReceiver.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/userTypeReceiver.kt deleted file mode 100644 index 03017afda32..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/userTypeReceiver.kt +++ /dev/null @@ -1,15 +0,0 @@ -// "Create type alias 'A'" "false" -// ACTION: Convert to block body -// ACTION: Create annotation 'A' -// ACTION: Create class 'A' -// ACTION: Create enum 'A' -// ACTION: Create interface 'A' -// ACTION: Remove explicit type specification -// ERROR: Unresolved reference: A -package p - -class T { - -} - -fun foo(): T.A = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/userTypeReceiverNoBody.kt b/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/userTypeReceiverNoBody.kt deleted file mode 100644 index 4e3c8b32ccf..00000000000 --- a/idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/userTypeReceiverNoBody.kt +++ /dev/null @@ -1,13 +0,0 @@ -// "Create type alias 'A'" "false" -// ACTION: Convert to block body -// ACTION: Create annotation 'A' -// ACTION: Create class 'A' -// ACTION: Create enum 'A' -// ACTION: Create interface 'A' -// ACTION: Remove explicit type specification -// ERROR: Unresolved reference: A -package p - -class T - -fun foo(): T.A = throw Throwable("") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/withTypeArguments.kt b/idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/withTypeArguments.kt index 431949e3002..ecca6957ac9 100644 --- a/idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/withTypeArguments.kt +++ b/idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/withTypeArguments.kt @@ -1,7 +1,6 @@ // "Create type parameter 'X'" "false" // ACTION: Create class 'X' // ACTION: Create interface 'X' -// ACTION: Create type alias 'X' // ERROR: Unresolved reference: X class A diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/dontChangeFunctionReturnTypeToErrorType.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/dontChangeFunctionReturnTypeToErrorType.kt index f445ce1f3ca..8ce1983095c 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/dontChangeFunctionReturnTypeToErrorType.kt +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/dontChangeFunctionReturnTypeToErrorType.kt @@ -3,7 +3,6 @@ // ACTION: Create class 'NoSuchType' // ACTION: Create enum 'NoSuchType' // ACTION: Create interface 'NoSuchType' -// ACTION: Create type alias 'NoSuchType' // ACTION: Remove explicit lambda parameter types (may break code) // ACTION: Create type parameter 'NoSuchType' in function 'foo' // ERROR: Type mismatch: inferred type is ([ERROR : NoSuchType]) -> Int but Int was expected diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java index 94b50f3a07f..0cba1818ede 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java @@ -2113,37 +2113,6 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes } } - @TestMetadata("idea/testData/quickfix/createFromUsage/createTypeAlias") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class CreateTypeAlias extends AbstractQuickFixMultiFileTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTestWithExtraFile, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInCreateTypeAlias() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createTypeAlias"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true); - } - - @TestMetadata("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class TypeReference extends AbstractQuickFixMultiFileTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTestWithExtraFile, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInTypeReference() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true); - } - - @TestMetadata("javaUserTypeReceiver.test") - public void testJavaUserTypeReceiver() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/javaUserTypeReceiver.test"); - } - } - } - @TestMetadata("idea/testData/quickfix/createFromUsage/createTypeParameter") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 15b82e531f2..bfbc72c3f13 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -4508,87 +4508,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } } - @TestMetadata("idea/testData/quickfix/createFromUsage/createTypeAlias") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class CreateTypeAlias extends AbstractQuickFixTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInCreateTypeAlias() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createTypeAlias"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class TypeReference extends AbstractQuickFixTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInTypeReference() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("currentPackageReceiver.kt") - public void testCurrentPackageReceiver() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/currentPackageReceiver.kt"); - } - - @TestMetadata("libTypeReceiver.kt") - public void testLibTypeReceiver() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/libTypeReceiver.kt"); - } - - @TestMetadata("notQualifierNoTypeArgs.kt") - public void testNotQualifierNoTypeArgs() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierNoTypeArgs.kt"); - } - - @TestMetadata("notQualifierWithStarProjection.kt") - public void testNotQualifierWithStarProjection() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithStarProjection.kt"); - } - - @TestMetadata("notQualifierWithTypeArgs.kt") - public void testNotQualifierWithTypeArgs() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierWithTypeArgs.kt"); - } - - @TestMetadata("qualifierNoTypeArgs.kt") - public void testQualifierNoTypeArgs() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/qualifierNoTypeArgs.kt"); - } - - @TestMetadata("recursiveTypeBound1.kt") - public void testRecursiveTypeBound1() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/recursiveTypeBound1.kt"); - } - - @TestMetadata("recursiveTypeBound2.kt") - public void testRecursiveTypeBound2() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/recursiveTypeBound2.kt"); - } - - @TestMetadata("typeParameterDependency.kt") - public void testTypeParameterDependency() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/typeParameterDependency.kt"); - } - - @TestMetadata("userTypeReceiver.kt") - public void testUserTypeReceiver() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/userTypeReceiver.kt"); - } - - @TestMetadata("userTypeReceiverNoBody.kt") - public void testUserTypeReceiverNoBody() throws Exception { - runTest("idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/userTypeReceiverNoBody.kt"); - } - } - } - @TestMetadata("idea/testData/quickfix/createFromUsage/createTypeParameter") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)