Remove CreateTypeAliasFromUsageFix
Relates to #KT-31519
This commit is contained in:
@@ -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)
|
||||
|
||||
-59
@@ -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<KtUserType, TypeAliasInfo>(IntentionActionPriority.LOW) {
|
||||
override fun getElementOfInterest(diagnostic: Diagnostic) = CreateClassFromTypeReferenceActionFactory.getElementOfInterest(diagnostic)
|
||||
|
||||
override fun extractFixData(element: KtUserType, diagnostic: Diagnostic): TypeAliasInfo? {
|
||||
if (element.getParentOfTypeAndBranch<KtUserType>(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)
|
||||
}
|
||||
-71
@@ -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<String>,
|
||||
val expectedType: KotlinType?
|
||||
)
|
||||
|
||||
class CreateTypeAliasFromUsageFix<E : KtElement>(
|
||||
element: E,
|
||||
private val aliasInfo: TypeAliasInfo
|
||||
) : CreateFromUsageFixBase<E>(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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
idea/testData/quickfix/createFromUsage/createClass/delegationSpecifier/classDelegatorToSuperclass.kt
Vendored
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
Vendored
-1
@@ -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'
|
||||
|
||||
Vendored
-1
@@ -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
|
||||
|
||||
Vendored
-1
@@ -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
|
||||
|
||||
Vendored
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
Vendored
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
Vendored
-1
@@ -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
|
||||
|
||||
Vendored
-1
@@ -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'
|
||||
|
||||
Vendored
-1
@@ -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
|
||||
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
// "Create type alias 'A'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
fun foo(): p.<caret>A = throw Throwable("")
|
||||
idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/currentPackageReceiver.kt.after
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
// "Create type alias 'A'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
typealias A = Dummy
|
||||
|
||||
fun foo(): p.A = throw Throwable("")
|
||||
Vendored
-19
@@ -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.<caret>A = throw Throwable("")
|
||||
|
||||
|
||||
// FILE: foo/JavaClass.java
|
||||
package foo;
|
||||
|
||||
public class JavaClass {
|
||||
}
|
||||
-7
@@ -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.<caret>A = throw Throwable("")
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "Create type alias 'X'" "true"
|
||||
open class A<T>
|
||||
|
||||
class B : A<B.X>() {
|
||||
typealias X = Dummy
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
// DISABLED: See KT-13596
|
||||
// "Create type alias 'X'" "true"
|
||||
open class A<T>
|
||||
|
||||
class B : A<B.<caret>X>()
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
// "Create type alias 'X'" "true"
|
||||
open class A<T>
|
||||
|
||||
class B : A<B.X>() {
|
||||
typealias X = Dummy
|
||||
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
// DISABLED: See KT-13596
|
||||
// "Create type alias 'X'" "true"
|
||||
open class A<T>
|
||||
|
||||
class B : A<B.<caret>X>() {
|
||||
|
||||
}
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
// "Create type alias 'A'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
fun foo(): <caret>A = throw Throwable("")
|
||||
idea/testData/quickfix/createFromUsage/createTypeAlias/typeReference/notQualifierNoTypeArgs.kt.after
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
// "Create type alias 'A'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
typealias A = Dummy
|
||||
|
||||
fun foo(): A = throw Throwable("")
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
// "Create type alias 'A'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
fun foo(): <caret>A<*, String> = throw Throwable("")
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
// "Create type alias 'A'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
typealias A<T, U> = Dummy
|
||||
|
||||
fun foo(): A<*, String> = throw Throwable("")
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
// "Create type alias 'A'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
fun foo(): <caret>A<Int, String> = throw Throwable("")
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
// "Create type alias 'A'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
typealias A<T, U> = Dummy
|
||||
|
||||
fun foo(): A<Int, String> = throw Throwable("")
|
||||
Vendored
-11
@@ -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(): <caret>A.B = throw Throwable("")
|
||||
Vendored
-11
@@ -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<T : List<T>>
|
||||
|
||||
fun foo(a: A<<caret>X<Int>>) {
|
||||
|
||||
}
|
||||
Vendored
-11
@@ -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<T, U : Map<T, U>>
|
||||
|
||||
fun foo(a: A<List<String>, <caret>X<Int>>) {
|
||||
|
||||
}
|
||||
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
// "Create type alias 'X'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
open class A<T, U : List<T>>
|
||||
|
||||
fun foo(a: A<List<String>, <caret>X<Int>>) {
|
||||
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
// "Create type alias 'X'" "true"
|
||||
// ERROR: Unresolved reference: Dummy
|
||||
package p
|
||||
|
||||
open class A<T, U : List<T>>
|
||||
|
||||
typealias X<T> = Dummy
|
||||
|
||||
fun foo(a: A<List<String>, X<Int>>) {
|
||||
|
||||
}
|
||||
-15
@@ -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.<caret>A = throw Throwable("")
|
||||
Vendored
-13
@@ -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.<caret>A = throw Throwable("")
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-31
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user