From 1b1eb10979fa1fdb0b5aa3cf21be70a8953c5477 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Fri, 31 Oct 2014 20:19:35 +0300 Subject: [PATCH] Create From Usage: Create class by constructor call --- .../plugin/quickfix/QuickFixRegistrar.java | 5 + .../callableBuilder/typeUtils.kt | 7 +- ...teClassFromConstructorCallActionFactory.kt | 82 ++++++ .../createClass/createClassUtils.kt | 3 +- ...FunctionOrPropertyFromCallActionFactory.kt | 4 +- ...QualifiedExpressionNotFirst.before.Main.kt | 1 + ...QualifiedExpressionNotFirst.before.Main.kt | 1 + .../autoImports/packageClass.before.Main.kt | 1 + .../afterCallInAnnotationEntry.kt | 8 + .../callExpression/afterCallInLambda.kt | 11 + .../afterCallInLocalFunNoReceiver.kt | 9 + .../afterCallInMemberFunNoReceiver.kt | 11 + .../afterCallInMemberValDelegateRuntime.kt | 14 + .../afterCallInMemberVarDelegateRuntime.kt | 14 + .../callExpression/afterCallNoReceiver.kt | 7 + .../afterCallWithClassQualifier.kt | 13 + .../afterCallWithExplicitParamNames.kt | 9 + .../afterCallWithGenericReceiver.kt | 15 + .../callExpression/afterCallWithLambdaArg.kt | 9 + .../afterCallWithLambdaArgOnly.kt | 9 + .../afterCallWithObjectQualifier.kt | 13 + .../afterCallWithPackageName.kt | 9 + .../callExpression/afterCallWithReceiver.kt | 13 + ...erCallWithSuperclassNoConstructorParams.kt | 9 + ...CallWithSuperclassWithConstructorParams.kt | 10 + .../callExpression/afterCallWithSupertrait.kt | 9 + .../afterCallWithThisReceiverInClass.kt | 9 + .../afterCallWithThisReceiverInExtension.kt | 11 + ...afterCallWithThisReceiverInNestedClass1.kt | 11 + ...afterCallWithThisReceiverInNestedClass2.kt | 11 + .../afterCallWithTypeArgsInAnnotationEntry.kt | 8 + .../afterSingleArgCallInAnnotationEntry.kt | 8 + ...fterSingleNamedArgCallInAnnotationEntry.kt | 8 + .../callExpression/afterUnusedCallResult.kt | 9 + .../beforeCallInAnnotationEntry.kt | 6 + .../callExpression/beforeCallInLambda.kt | 7 + .../beforeCallInLocalFunNoReceiver.kt | 5 + .../beforeCallInMemberFunNoReceiver.kt | 7 + .../beforeCallInMemberValDelegateRuntime.kt | 8 + .../beforeCallInMemberVarDelegateRuntime.kt | 8 + .../callExpression/beforeCallNoReceiver.kt | 3 + .../beforeCallWithClassQualifier.kt | 9 + .../beforeCallWithExplicitParamNames.kt | 5 + .../callExpression/beforeCallWithExtraArgs.kt | 11 + .../beforeCallWithFinalSupertype.kt | 8 + .../beforeCallWithGenericReceiver.kt | 11 + .../callExpression/beforeCallWithLambdaArg.kt | 5 + .../beforeCallWithLambdaArgOnly.kt | 5 + .../beforeCallWithLibClassQualifier.kt | 9 + .../beforeCallWithMissingArgs.kt | 11 + .../beforeCallWithObjectQualifier.kt | 9 + .../beforeCallWithPackageName.kt | 5 + .../callExpression/beforeCallWithReceiver.kt | 9 + ...reCallWithSuperclassNoConstructorParams.kt | 5 + ...CallWithSuperclassWithConstructorParams.kt | 6 + .../beforeCallWithSupertrait.kt | 5 + .../beforeCallWithThisReceiverInClass.kt | 5 + .../beforeCallWithThisReceiverInExtension.kt | 7 + ...eforeCallWithThisReceiverInNestedClass1.kt | 7 + ...eforeCallWithThisReceiverInNestedClass2.kt | 7 + ...beforeCallWithTypeArgsInAnnotationEntry.kt | 6 + .../beforeSingleArgCallInAnnotationEntry.kt | 6 + ...foreSingleNamedArgCallInAnnotationEntry.kt | 6 + .../callExpression/beforeUnusedCallResult.kt | 5 + .../callWithJavaClassReceiver.before.Main.kt | 8 + ...hJavaClassReceiver.before.data.Sample.java | 3 + .../typeArguments/afterClassMember.kt | 13 + .../typeArguments/afterClassMemberInner.kt | 15 + ...fterClassMemberInnerPartialSubstitution.kt | 14 + .../afterClassMemberInnerWithReceiverArg.kt | 15 + .../afterClassMemberPartialSubstitution.kt | 13 + .../typeArguments/afterNoReceiver.kt | 7 + .../typeArguments/afterNoReceiverExtraArgs.kt | 7 + .../typeArguments/afterNoReceiverLongName.kt | 7 + .../afterNoReceiverPartialSubstitution.kt | 7 + .../afterWithExpectedTypeNoReceiver.kt | 11 + .../typeArguments/beforeClassMember.kt | 9 + .../typeArguments/beforeClassMemberInner.kt | 11 + ...foreClassMemberInnerPartialSubstitution.kt | 10 + .../beforeClassMemberInnerWithReceiverArg.kt | 11 + .../beforeClassMemberPartialSubstitution.kt | 9 + .../typeArguments/beforeExtension.kt | 7 + .../typeArguments/beforeNoReceiver.kt | 3 + .../beforeNoReceiverExtraArgs.kt | 3 + .../typeArguments/beforeNoReceiverLongName.kt | 3 + .../beforeNoReceiverPartialSubstitution.kt | 3 + .../beforeWithExpectedTypeNoReceiver.kt | 7 + .../call/beforeCallInAnnotationEntry.kt | 8 + .../QuickFixMultiFileTestGenerated.java | 19 +- .../quickfix/QuickFixTestGenerated.java | 273 +++++++++++++++++- 90 files changed, 1068 insertions(+), 5 deletions(-) create mode 100644 idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createClass/CreateClassFromConstructorCallActionFactory.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInAnnotationEntry.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInLambda.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInLocalFunNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberFunNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberValDelegateRuntime.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberVarDelegateRuntime.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithClassQualifier.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithExplicitParamNames.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithGenericReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArg.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArgOnly.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithObjectQualifier.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithPackageName.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSuperclassNoConstructorParams.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSuperclassWithConstructorParams.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSupertrait.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInClass.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInExtension.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInNestedClass1.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInNestedClass2.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithTypeArgsInAnnotationEntry.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterSingleArgCallInAnnotationEntry.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterSingleNamedArgCallInAnnotationEntry.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/afterUnusedCallResult.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInAnnotationEntry.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLambda.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLocalFunNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberFunNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberValDelegateRuntime.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberVarDelegateRuntime.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithClassQualifier.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExplicitParamNames.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExtraArgs.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithFinalSupertype.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithGenericReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArg.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArgOnly.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLibClassQualifier.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithMissingArgs.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithObjectQualifier.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithPackageName.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassNoConstructorParams.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassWithConstructorParams.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSupertrait.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInClass.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInExtension.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass1.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass2.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithTypeArgsInAnnotationEntry.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleArgCallInAnnotationEntry.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleNamedArgCallInAnnotationEntry.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeUnusedCallResult.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithJavaClassReceiver.before.Main.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithJavaClassReceiver.before.data.Sample.java create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMember.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInner.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInnerPartialSubstitution.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInnerWithReceiverArg.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberPartialSubstitution.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverExtraArgs.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverLongName.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverPartialSubstitution.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterWithExpectedTypeNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMember.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInner.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerPartialSubstitution.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerWithReceiverArg.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberPartialSubstitution.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeExtension.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverExtraArgs.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverLongName.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverPartialSubstitution.kt create mode 100644 idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeWithExpectedTypeNoReceiver.kt create mode 100644 idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallInAnnotationEntry.kt diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixRegistrar.java b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixRegistrar.java index 2830e6ee334..c329a83f2b6 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixRegistrar.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixRegistrar.java @@ -18,6 +18,7 @@ package org.jetbrains.jet.plugin.quickfix; import org.jetbrains.jet.lang.psi.JetClass; import org.jetbrains.jet.plugin.codeInsight.ImplementMethodsHandler; +import org.jetbrains.jet.plugin.quickfix.createFromUsage.createClass.CreateClassFromConstructorCallActionFactory; import org.jetbrains.jet.plugin.quickfix.createFromUsage.createClass.CreateClassFromTypeReferenceActionFactory; import org.jetbrains.jet.plugin.quickfix.createFromUsage.createClass.CreateClassFromReferenceExpressionActionFactory; import org.jetbrains.jet.plugin.quickfix.createFromUsage.createFunction.*; @@ -242,6 +243,10 @@ public class QuickFixRegistrar { QuickFixes.factories.put(TOO_MANY_ARGUMENTS, CreateFunctionOrPropertyFromCallActionFactory.INSTANCE$); QuickFixes.factories.put(EXPRESSION_EXPECTED_PACKAGE_FOUND, CreateFunctionOrPropertyFromCallActionFactory.INSTANCE$); + QuickFixes.factories.put(UNRESOLVED_REFERENCE_WRONG_RECEIVER, CreateClassFromConstructorCallActionFactory.INSTANCE$); + QuickFixes.factories.put(UNRESOLVED_REFERENCE, CreateClassFromConstructorCallActionFactory.INSTANCE$); + QuickFixes.factories.put(EXPRESSION_EXPECTED_PACKAGE_FOUND, CreateClassFromConstructorCallActionFactory.INSTANCE$); + QuickFixes.factories.put(UNRESOLVED_REFERENCE, CreateLocalVariableActionFactory.INSTANCE$); QuickFixes.factories.put(EXPRESSION_EXPECTED_PACKAGE_FOUND, CreateLocalVariableActionFactory.INSTANCE$); diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/callableBuilder/typeUtils.kt b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/callableBuilder/typeUtils.kt index 83d4c5e4c08..ec7c7f388d4 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/callableBuilder/typeUtils.kt +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/callableBuilder/typeUtils.kt @@ -34,6 +34,8 @@ import org.jetbrains.jet.lang.resolve.name.FqName import kotlin.properties.Delegates import org.jetbrains.jet.lang.descriptors.PropertyDescriptor import org.jetbrains.jet.plugin.util.makeNotNullable +import org.jetbrains.jet.lang.psi.JetAnnotationEntry +import org.jetbrains.jet.lang.psi.psiUtil.getParentByType private fun JetType.contains(inner: JetType): Boolean { return JetTypeChecker.DEFAULT.equalTypes(this, inner) || getArguments().any { inner in it.getType() } @@ -90,7 +92,10 @@ fun JetExpression.guessTypes( ): Array { val builtIns = KotlinBuiltIns.getInstance() - if (coerceUnusedToUnit && this !is JetDeclaration && isUsedAsStatement(context)) return array(builtIns.getUnitType()) + if (coerceUnusedToUnit + && this !is JetDeclaration + && isUsedAsStatement(context) + && getParentByType(javaClass()) == null) return array(builtIns.getUnitType()) // if we know the actual type of the expression val theType1 = context[BindingContext.EXPRESSION_TYPE, this] diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createClass/CreateClassFromConstructorCallActionFactory.kt b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createClass/CreateClassFromConstructorCallActionFactory.kt new file mode 100644 index 00000000000..c9bc3b3971c --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createClass/CreateClassFromConstructorCallActionFactory.kt @@ -0,0 +1,82 @@ +package org.jetbrains.jet.plugin.quickfix.createFromUsage.createClass + +import org.jetbrains.jet.lang.diagnostics.Diagnostic +import com.intellij.codeInsight.intention.IntentionAction +import org.jetbrains.jet.lang.psi.psiUtil.getParentByType +import org.jetbrains.jet.lang.psi.JetTypeReference +import org.jetbrains.jet.lang.psi.JetCallExpression +import org.jetbrains.jet.lang.psi.JetSimpleNameExpression +import org.jetbrains.jet.lang.psi.JetQualifiedExpression +import org.jetbrains.jet.lang.resolve.calls.callUtil.getCall +import org.jetbrains.jet.plugin.quickfix.createFromUsage.callableBuilder.TypeInfo +import org.jetbrains.jet.lang.types.Variance +import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns +import org.jetbrains.jet.plugin.quickfix.createFromUsage.callableBuilder.ParameterInfo +import org.jetbrains.jet.plugin.quickfix.JetSingleIntentionActionFactory +import org.jetbrains.jet.plugin.caches.resolve.getAnalysisResults +import org.jetbrains.jet.lang.psi.JetFile +import org.jetbrains.jet.lang.psi.JetAnnotationEntry +import java.util.Collections + +public object CreateClassFromConstructorCallActionFactory: JetSingleIntentionActionFactory() { + override fun createAction(diagnostic: Diagnostic): IntentionAction? { + val diagElement = diagnostic.getPsiElement() + if (diagElement.getParentByType(javaClass()) != null) return null + + val inAnnotationEntry = diagElement.getParentByType(javaClass()) != null + + val callExpr = diagElement.getParent() as? JetCallExpression ?: return null + if (callExpr.getCalleeExpression() != diagElement) return null + + val calleeExpr = callExpr.getCalleeExpression() as? JetSimpleNameExpression ?: return null + + val name = calleeExpr.getReferencedName() + if (!inAnnotationEntry && !name.checkClassName()) return null + + val callParent = callExpr.getParent() + val fullCallExpr = + if (callParent is JetQualifiedExpression && callParent.getSelectorExpression() == callExpr) callParent else callExpr + + val file = fullCallExpr.getContainingFile() as? JetFile ?: return null + + val exhaust = callExpr.getAnalysisResults() + val context = exhaust.getBindingContext() + + val call = callExpr.getCall(context) ?: return null + val targetParent = getTargetParentByCall(call, file) ?: return null + val inner = isInnerClassExpected(call) + + val valueArguments = callExpr.getValueArguments() + val defaultParamName = if (inAnnotationEntry && valueArguments.size == 1) "value" else null + val anyType = KotlinBuiltIns.getInstance().getNullableAnyType() + val parameterInfos = valueArguments.map { + ParameterInfo( + it.getArgumentExpression()?.let { TypeInfo(it, Variance.IN_VARIANCE) } ?: TypeInfo(anyType, Variance.IN_VARIANCE), + it.getArgumentName()?.getReferenceExpression()?.getReferencedName() ?: defaultParamName + ) + } + + val classKind = if (inAnnotationEntry) ClassKind.ANNOTATION_CLASS else ClassKind.PLAIN_CLASS + + val (expectedTypeInfo, filter) = fullCallExpr.getInheritableTypeInfo(context, exhaust.getModuleDescriptor(), targetParent) + if (!filter(classKind)) return null + + val typeArgumentInfos = if (inAnnotationEntry) { + Collections.emptyList() + } + else { + callExpr.getTypeArguments().map { TypeInfo(it.getTypeReference(), Variance.INVARIANT) } + } + + val classInfo = ClassInfo( + kind = classKind, + name = name, + targetParent = targetParent, + expectedTypeInfo = expectedTypeInfo, + inner = inner, + typeArguments = typeArgumentInfos, + parameterInfos = parameterInfos + ) + return CreateClassFromUsageFix(callExpr, classInfo) + } +} \ No newline at end of file diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createClass/createClassUtils.kt b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createClass/createClassUtils.kt index d6c241b21c0..8efed47bfd4 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createClass/createClassUtils.kt +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createClass/createClassUtils.kt @@ -23,6 +23,7 @@ import org.jetbrains.jet.lang.psi.Call import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue import org.jetbrains.jet.lang.resolve.scopes.receivers.Qualifier import org.jetbrains.jet.plugin.util.ProjectRootsUtil +import org.jetbrains.jet.plugin.quickfix.createFromUsage.callableBuilder.noSubstitutions import org.jetbrains.jet.lang.resolve.DescriptorUtils import org.jetbrains.jet.lang.resolve.DescriptorToSourceUtils @@ -90,7 +91,7 @@ private fun JetExpression.getInheritableTypeInfo( if (!(canHaveSubtypes || isEnum) || descriptor is TypeParameterDescriptor) return TypeInfo.Empty to { classKind -> false } - return TypeInfo.ByType(type, Variance.OUT_VARIANCE) to { classKind -> + return TypeInfo.ByType(type, Variance.OUT_VARIANCE).noSubstitutions() to { classKind -> when (classKind) { ClassKind.ENUM_ENTRY -> isEnum && containingDeclaration == DescriptorToSourceUtils.descriptorToDeclaration(descriptor) else -> canHaveSubtypes diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createFunction/CreateFunctionOrPropertyFromCallActionFactory.kt b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createFunction/CreateFunctionOrPropertyFromCallActionFactory.kt index 6b0a825e196..53019ea3ead 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createFunction/CreateFunctionOrPropertyFromCallActionFactory.kt +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/createFromUsage/createFunction/CreateFunctionOrPropertyFromCallActionFactory.kt @@ -24,11 +24,13 @@ import org.jetbrains.jet.lang.psi.JetFile import org.jetbrains.jet.lang.psi.psiUtil.getAssignmentByLHS import org.jetbrains.jet.lang.resolve.BindingContext import org.jetbrains.jet.lang.psi.JetTypeReference +import com.intellij.psi.util.PsiTreeUtil +import org.jetbrains.jet.lang.psi.JetAnnotationEntry object CreateFunctionOrPropertyFromCallActionFactory : JetSingleIntentionActionFactory() { override fun createAction(diagnostic: Diagnostic): IntentionAction? { val diagElement = diagnostic.getPsiElement() - if (diagElement.getParentByType(javaClass()) != null) return null + if (PsiTreeUtil.getParentOfType(diagElement, javaClass(), javaClass()) != null) return null val callExpr = when (diagnostic.getFactory()) { in Errors.UNRESOLVED_REFERENCE_DIAGNOSTICS, Errors.EXPRESSION_EXPECTED_PACKAGE_FOUND -> { diff --git a/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt index e75dc3b995e..46c2dda814f 100644 --- a/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt @@ -1,4 +1,5 @@ // "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false" +// ACTION: Create class 'SomeTest' // ERROR: Unresolved reference: SomeTest package testing diff --git a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt index 23551200097..1305266e16b 100644 --- a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt @@ -1,5 +1,6 @@ // "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false" // ERROR: Unresolved reference: SomeTest +// ACTION: Create class 'SomeTest' // ACTION: Edit intention settings // ACTION: Replace safe access expression with 'if' expression // ACTION: Disable 'Replace Safe Access Expression with 'if' Expression' diff --git a/idea/testData/quickfix/autoImports/packageClass.before.Main.kt b/idea/testData/quickfix/autoImports/packageClass.before.Main.kt index 939acd4e3a8..bdd5de837a2 100644 --- a/idea/testData/quickfix/autoImports/packageClass.before.Main.kt +++ b/idea/testData/quickfix/autoImports/packageClass.before.Main.kt @@ -1,5 +1,6 @@ // "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false" // ACTION: Create function 'FooPackage' +// ACTION: Create class 'FooPackage' // ERROR: Unresolved reference: FooPackage package packageClass diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInAnnotationEntry.kt new file mode 100644 index 00000000000..95adfcc75d5 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInAnnotationEntry.kt @@ -0,0 +1,8 @@ +// "Create annotation 'bar'" "true" +// ERROR: Unresolved reference: foo + +[foo(1, "2", bar("3", 4))] fun test() { + +} + +annotation class bar(val s: String, val i: Int) \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInLambda.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInLambda.kt new file mode 100644 index 00000000000..a4932e904f4 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInLambda.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "true" + +fun run(f: () -> T) = f() + +fun test() { + run { Foo() } +} + +class Foo { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInLocalFunNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInLocalFunNoReceiver.kt new file mode 100644 index 00000000000..a9efc4c104a --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInLocalFunNoReceiver.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +fun test() { + fun nestedTest() = Foo(2, "2") +} + +class Foo(i: Int, s: String) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberFunNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberFunNoReceiver.kt new file mode 100644 index 00000000000..8928c9bc86c --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberFunNoReceiver.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "true" + +class A { + class B { + fun test() = Foo(2, "2") + } +} + +class Foo(i: Int, s: String) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberValDelegateRuntime.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberValDelegateRuntime.kt new file mode 100644 index 00000000000..c5b7a879d1f --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberValDelegateRuntime.kt @@ -0,0 +1,14 @@ +// "Create class 'Foo'" "true" +// ERROR: Class 'Foo' must be declared abstract or implement abstract member
public abstract fun get(thisRef: A<T>, desc: kotlin.PropertyMetadata): B defined in kotlin.properties.ReadOnlyProperty + +import kotlin.properties.ReadOnlyProperty + +open class B + +class A(val t: T) { + val x: B by Foo(t, "") +} + +class Foo(t: T, s: String) : ReadOnlyProperty, B> { + +} diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberVarDelegateRuntime.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberVarDelegateRuntime.kt new file mode 100644 index 00000000000..721be40b610 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallInMemberVarDelegateRuntime.kt @@ -0,0 +1,14 @@ +// "Create class 'Foo'" "true" +// DISABLE-ERRORS + +import kotlin.properties.ReadWriteProperty + +open class B + +class A(val t: T) { + var x: B by Foo(t, "") +} + +class Foo(t: T, s: String) : ReadWriteProperty, B> { + +} diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallNoReceiver.kt new file mode 100644 index 00000000000..09bf85afe5b --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallNoReceiver.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") + +class Foo(i: Int, s: String) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithClassQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithClassQualifier.kt new file mode 100644 index 00000000000..9c1d639388f --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithClassQualifier.kt @@ -0,0 +1,13 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + + class Foo(i: Int) { + + } + +} + +fun test() { + val a = A.Foo(2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithExplicitParamNames.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithExplicitParamNames.kt new file mode 100644 index 00000000000..4fa97decc9c --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithExplicitParamNames.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +class A(n: Int) + +fun test() = Foo(abc = 1, ghi = A(2), def = "s") + +class Foo(abc: Int, ghi: A, def: String) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithGenericReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithGenericReceiver.kt new file mode 100644 index 00000000000..23e08fc7ca7 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithGenericReceiver.kt @@ -0,0 +1,15 @@ +// "Create class 'Foo'" "true" +// ERROR: Type inference failed:
constructor Foo<U>(u: U)
cannot be applied to
(U)
+// ERROR: Type mismatch.
Required:U
Found:U
+ +class A(val n: T) { + + inner class Foo(u: U) { + + } + +} + +fun test(u: U) { + val a = A(u).Foo(u) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArg.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArg.kt new file mode 100644 index 00000000000..eee1d1a3919 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArg.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +fun test() { + val a = Foo(2, "2") { (p: Int) -> p + 1 } +} + +class Foo(i: Int, s: String, function: Function1) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArgOnly.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArgOnly.kt new file mode 100644 index 00000000000..a845dc5c344 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArgOnly.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +fun test() { + val a = Foo { (p: Int) -> p + 1 } +} + +class Foo(function: Function1) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithObjectQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithObjectQualifier.kt new file mode 100644 index 00000000000..22b33a74815 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithObjectQualifier.kt @@ -0,0 +1,13 @@ +// "Create class 'Foo'" "true" + +object A { + + class Foo(i: Int) { + + } + +} + +fun test() { + val a = A.Foo(2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithPackageName.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithPackageName.kt new file mode 100644 index 00000000000..171d278107e --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithPackageName.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +package Foo + +fun test() = Foo(2, "2") + +class Foo(i: Int, s: String) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithReceiver.kt new file mode 100644 index 00000000000..b98cfe6d764 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithReceiver.kt @@ -0,0 +1,13 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + + inner class Foo(i: Int) { + + } + +} + +fun test() { + val a = A(1).Foo(2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSuperclassNoConstructorParams.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSuperclassNoConstructorParams.kt new file mode 100644 index 00000000000..50560c7803a --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSuperclassNoConstructorParams.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +open class A + +fun test(): A = Foo(2, "2") + +class Foo(i: Int, s: String) : A() { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSuperclassWithConstructorParams.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSuperclassWithConstructorParams.kt new file mode 100644 index 00000000000..3d6fe6e56e2 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSuperclassWithConstructorParams.kt @@ -0,0 +1,10 @@ +// "Create class 'Foo'" "true" +// ERROR: No value passed for parameter n + +open class A(n: Int) + +fun test(): A = Foo(2, "2") + +class Foo(i: Int, s: String) : A() { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSupertrait.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSupertrait.kt new file mode 100644 index 00000000000..342d0561d14 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithSupertrait.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +trait A + +fun test(): A = Foo(2, "2") + +class Foo(i: Int, s: String) : A { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInClass.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInClass.kt new file mode 100644 index 00000000000..6deab77cda1 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInClass.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + inner class Foo(i: Int, s: String) { + + } + + fun test() = this.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInExtension.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInExtension.kt new file mode 100644 index 00000000000..36c33d98a5f --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInExtension.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + + inner class Foo(i: Int, s: String) { + + } + +} + +fun A.test() = this.Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInNestedClass1.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInNestedClass1.kt new file mode 100644 index 00000000000..7deebb1a224 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInNestedClass1.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + inner class B(val m: U) { + inner class Foo(i: Int, s: String) { + + } + + fun test() = this.Foo(2, "2") + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInNestedClass2.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInNestedClass2.kt new file mode 100644 index 00000000000..90734173d93 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithThisReceiverInNestedClass2.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + inner class Foo(i: Int, s: String) { + + } + + inner class B(val m: U) { + fun test() = this@A.Foo(2, "2") + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithTypeArgsInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithTypeArgsInAnnotationEntry.kt new file mode 100644 index 00000000000..95adfcc75d5 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithTypeArgsInAnnotationEntry.kt @@ -0,0 +1,8 @@ +// "Create annotation 'bar'" "true" +// ERROR: Unresolved reference: foo + +[foo(1, "2", bar("3", 4))] fun test() { + +} + +annotation class bar(val s: String, val i: Int) \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterSingleArgCallInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterSingleArgCallInAnnotationEntry.kt new file mode 100644 index 00000000000..f19b8e6bf42 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterSingleArgCallInAnnotationEntry.kt @@ -0,0 +1,8 @@ +// "Create annotation 'bar'" "true" +// ERROR: Unresolved reference: foo + +[foo(1, "2", bar("3"))] fun test() { + +} + +annotation class bar(val value: String) \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterSingleNamedArgCallInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterSingleNamedArgCallInAnnotationEntry.kt new file mode 100644 index 00000000000..54b6f084ef2 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterSingleNamedArgCallInAnnotationEntry.kt @@ -0,0 +1,8 @@ +// "Create annotation 'bar'" "true" +// ERROR: Unresolved reference: foo + +[foo(1, "2", bar(fooBar = "3"))] fun test() { + +} + +annotation class bar(val fooBar: String) \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterUnusedCallResult.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterUnusedCallResult.kt new file mode 100644 index 00000000000..625e5d89230 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterUnusedCallResult.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +fun test() { + Foo(2, "2") +} + +class Foo(i: Int, s: String) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInAnnotationEntry.kt new file mode 100644 index 00000000000..afbed7f5f33 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInAnnotationEntry.kt @@ -0,0 +1,6 @@ +// "Create annotation 'bar'" "true" +// ERROR: Unresolved reference: foo + +[foo(1, "2", bar("3", 4))] fun test() { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLambda.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLambda.kt new file mode 100644 index 00000000000..accd066cf1f --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLambda.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +fun run(f: () -> T) = f() + +fun test() { + run { Foo() } +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLocalFunNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLocalFunNoReceiver.kt new file mode 100644 index 00000000000..fe5f2b29889 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLocalFunNoReceiver.kt @@ -0,0 +1,5 @@ +// "Create class 'Foo'" "true" + +fun test() { + fun nestedTest() = Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberFunNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberFunNoReceiver.kt new file mode 100644 index 00000000000..042e7f40607 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberFunNoReceiver.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +class A { + class B { + fun test() = Foo(2, "2") + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberValDelegateRuntime.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberValDelegateRuntime.kt new file mode 100644 index 00000000000..05bd0791b3d --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberValDelegateRuntime.kt @@ -0,0 +1,8 @@ +// "Create class 'Foo'" "true" +// ERROR: Class 'Foo' must be declared abstract or implement abstract member
public abstract fun get(thisRef: A<T>, desc: kotlin.PropertyMetadata): B defined in kotlin.properties.ReadOnlyProperty + +open class B + +class A(val t: T) { + val x: B by Foo(t, "") +} diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberVarDelegateRuntime.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberVarDelegateRuntime.kt new file mode 100644 index 00000000000..559da6925d8 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberVarDelegateRuntime.kt @@ -0,0 +1,8 @@ +// "Create class 'Foo'" "true" +// DISABLE-ERRORS + +open class B + +class A(val t: T) { + var x: B by Foo(t, "") +} diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallNoReceiver.kt new file mode 100644 index 00000000000..01dc577ebd2 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallNoReceiver.kt @@ -0,0 +1,3 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithClassQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithClassQualifier.kt new file mode 100644 index 00000000000..fd80a9b6307 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithClassQualifier.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + +} + +fun test() { + val a = A.Foo(2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExplicitParamNames.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExplicitParamNames.kt new file mode 100644 index 00000000000..cea2e131bef --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExplicitParamNames.kt @@ -0,0 +1,5 @@ +// "Create class 'Foo'" "true" + +class A(n: Int) + +fun test() = Foo(abc = 1, ghi = A(2), def = "s") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExtraArgs.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExtraArgs.kt new file mode 100644 index 00000000000..0df97111c85 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExtraArgs.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "false" +// ACTION: Create function 'Foo' +// ACTION: Add parameter to constructor 'Foo' +// ACTION: Split property declaration +// ERROR: Too many arguments for public constructor Foo(a: kotlin.Int) defined in Foo + +class Foo(a: Int) + +fun test() { + val a = Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithFinalSupertype.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithFinalSupertype.kt new file mode 100644 index 00000000000..406a540d987 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithFinalSupertype.kt @@ -0,0 +1,8 @@ +// "Create class 'Foo'" "false" +// ACTION: Create function 'Foo' +// ACTION: Convert to block body +// ERROR: Unresolved reference: Foo + +final class A + +fun test(): A = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithGenericReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithGenericReceiver.kt new file mode 100644 index 00000000000..edb9cd4048a --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithGenericReceiver.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "true" +// ERROR: Type inference failed:
constructor Foo<U>(u: U)
cannot be applied to
(U)
+// ERROR: Type mismatch.
Required:U
Found:U
+ +class A(val n: T) { + +} + +fun test(u: U) { + val a = A(u).Foo(u) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArg.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArg.kt new file mode 100644 index 00000000000..6108a0976b3 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArg.kt @@ -0,0 +1,5 @@ +// "Create class 'Foo'" "true" + +fun test() { + val a = Foo(2, "2") { (p: Int) -> p + 1 } +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArgOnly.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArgOnly.kt new file mode 100644 index 00000000000..b10becc19cc --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArgOnly.kt @@ -0,0 +1,5 @@ +// "Create class 'Foo'" "true" + +fun test() { + val a = Foo { (p: Int) -> p + 1 } +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLibClassQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLibClassQualifier.kt new file mode 100644 index 00000000000..5395c73c66a --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLibClassQualifier.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "false" +// ACTION: Create function 'Foo' +// ACTION: Replace with infix function call +// ACTION: Split property declaration +// ERROR: Unresolved reference: Foo + +fun test() { + val a = 2.Foo(1) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithMissingArgs.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithMissingArgs.kt new file mode 100644 index 00000000000..b7531fc132b --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithMissingArgs.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "false" +// ACTION: Create function 'Foo' +// ACTION: Remove parameter 's' +// ACTION: Split property declaration +// ERROR: No value passed for parameter s + +class Foo(i: Int, s: String) + +fun test() { + val a = Foo(2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithObjectQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithObjectQualifier.kt new file mode 100644 index 00000000000..e36a54f4a68 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithObjectQualifier.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +object A { + +} + +fun test() { + val a = A.Foo(2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithPackageName.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithPackageName.kt new file mode 100644 index 00000000000..d3663863328 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithPackageName.kt @@ -0,0 +1,5 @@ +// "Create class 'Foo'" "true" + +package Foo + +fun test() = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithReceiver.kt new file mode 100644 index 00000000000..530c739f81b --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithReceiver.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + +} + +fun test() { + val a = A(1).Foo(2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassNoConstructorParams.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassNoConstructorParams.kt new file mode 100644 index 00000000000..e7cb2908fae --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassNoConstructorParams.kt @@ -0,0 +1,5 @@ +// "Create class 'Foo'" "true" + +open class A + +fun test(): A = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassWithConstructorParams.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassWithConstructorParams.kt new file mode 100644 index 00000000000..fbfd9fa2cf5 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassWithConstructorParams.kt @@ -0,0 +1,6 @@ +// "Create class 'Foo'" "true" +// ERROR: No value passed for parameter n + +open class A(n: Int) + +fun test(): A = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSupertrait.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSupertrait.kt new file mode 100644 index 00000000000..af63b7b17a9 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSupertrait.kt @@ -0,0 +1,5 @@ +// "Create class 'Foo'" "true" + +trait A + +fun test(): A = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInClass.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInClass.kt new file mode 100644 index 00000000000..e281da50a42 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInClass.kt @@ -0,0 +1,5 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + fun test() = this.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInExtension.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInExtension.kt new file mode 100644 index 00000000000..f1f175d30f2 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInExtension.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + +} + +fun A.test() = this.Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass1.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass1.kt new file mode 100644 index 00000000000..e228d8e7ffd --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass1.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + inner class B(val m: U) { + fun test() = this.Foo(2, "2") + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass2.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass2.kt new file mode 100644 index 00000000000..580e39a1eee --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass2.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +class A(val n: T) { + inner class B(val m: U) { + fun test() = this@A.Foo(2, "2") + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithTypeArgsInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithTypeArgsInAnnotationEntry.kt new file mode 100644 index 00000000000..5678173a0d5 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithTypeArgsInAnnotationEntry.kt @@ -0,0 +1,6 @@ +// "Create annotation 'bar'" "true" +// ERROR: Unresolved reference: foo + +[foo(1, "2", bar("3", 4))] fun test() { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleArgCallInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleArgCallInAnnotationEntry.kt new file mode 100644 index 00000000000..7a7a81c29ae --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleArgCallInAnnotationEntry.kt @@ -0,0 +1,6 @@ +// "Create annotation 'bar'" "true" +// ERROR: Unresolved reference: foo + +[foo(1, "2", bar("3"))] fun test() { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleNamedArgCallInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleNamedArgCallInAnnotationEntry.kt new file mode 100644 index 00000000000..d96881e9adf --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleNamedArgCallInAnnotationEntry.kt @@ -0,0 +1,6 @@ +// "Create annotation 'bar'" "true" +// ERROR: Unresolved reference: foo + +[foo(1, "2", bar(fooBar = "3"))] fun test() { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeUnusedCallResult.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeUnusedCallResult.kt new file mode 100644 index 00000000000..df05df5ca6b --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeUnusedCallResult.kt @@ -0,0 +1,5 @@ +// "Create class 'Foo'" "true" + +fun test() { + Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithJavaClassReceiver.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithJavaClassReceiver.before.Main.kt new file mode 100644 index 00000000000..d519b1e4e8a --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithJavaClassReceiver.before.Main.kt @@ -0,0 +1,8 @@ +// "Create class 'Foo'" "false" +// ACTION: Create function 'Foo' +// ACTION: Convert to expression body +// ERROR: Unresolved reference: Foo + +fun test(): Int { + return A().Foo(1, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithJavaClassReceiver.before.data.Sample.java b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithJavaClassReceiver.before.data.Sample.java new file mode 100644 index 00000000000..1b4568a8f26 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithJavaClassReceiver.before.data.Sample.java @@ -0,0 +1,3 @@ +class A { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMember.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMember.kt new file mode 100644 index 00000000000..d8d227943e0 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMember.kt @@ -0,0 +1,13 @@ +// "Create class 'Foo'" "true" + +class B(val t: T) { + + class Foo(u: U, v: V) { + + } + +} + +class A(val b: B) { + fun test() = B.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInner.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInner.kt new file mode 100644 index 00000000000..33d95ca294e --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInner.kt @@ -0,0 +1,15 @@ +// "Create class 'Foo'" "true" +// ERROR: Type mismatch.
Required:V
Found:kotlin.String
+// ERROR: An integer literal does not conform to the expected type U + +class B(val t: T) { + + inner class Foo(u: U, v: V) { + + } + +} + +class A(val b: B) { + fun test() = b.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInnerPartialSubstitution.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInnerPartialSubstitution.kt new file mode 100644 index 00000000000..3ae05204378 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInnerPartialSubstitution.kt @@ -0,0 +1,14 @@ +// "Create class 'Foo'" "true" +// ERROR: Type mismatch.
Required:U
Found:kotlin.String
+ +class B(val t: T) { + + inner class Foo(i: Int, u: U) { + + } + +} + +class A(val b: B) { + fun test() = b.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInnerWithReceiverArg.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInnerWithReceiverArg.kt new file mode 100644 index 00000000000..9cab6c47f15 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberInnerWithReceiverArg.kt @@ -0,0 +1,15 @@ +// "Create class 'Foo'" "true" +// ERROR: Type mismatch.
Required:W
Found:kotlin.String
+// ERROR: An integer literal does not conform to the expected type V + +class B(val t: T) { + + inner class Foo(v: V, w: W) { + + } + +} + +class A(val b: B) { + fun test() = b.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberPartialSubstitution.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberPartialSubstitution.kt new file mode 100644 index 00000000000..6dd1c989506 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterClassMemberPartialSubstitution.kt @@ -0,0 +1,13 @@ +// "Create class 'Foo'" "true" + +class B(val t: T) { + + class Foo(i: Int, u: U) { + + } + +} + +class A(val b: B) { + fun test() = B.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiver.kt new file mode 100644 index 00000000000..0c8e5d31ab7 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiver.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") + +class Foo(u: U, t: T) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverExtraArgs.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverExtraArgs.kt new file mode 100644 index 00000000000..331eec57870 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverExtraArgs.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") + +class Foo(u: U, t: T) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverLongName.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverLongName.kt new file mode 100644 index 00000000000..0c8e5d31ab7 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverLongName.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") + +class Foo(u: U, t: T) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverPartialSubstitution.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverPartialSubstitution.kt new file mode 100644 index 00000000000..ec1bd05d5e0 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterNoReceiverPartialSubstitution.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") + +class Foo(t: T, s: String) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterWithExpectedTypeNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterWithExpectedTypeNoReceiver.kt new file mode 100644 index 00000000000..bf6caaa8474 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/afterWithExpectedTypeNoReceiver.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "true" + +open class A { + +} + +fun test(a: A): A = Foo(a, 1) + +class Foo(a: T, u: U) : A() { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMember.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMember.kt new file mode 100644 index 00000000000..2c02a0d3d3a --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMember.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +class B(val t: T) { + +} + +class A(val b: B) { + fun test() = B.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInner.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInner.kt new file mode 100644 index 00000000000..31a80c3cbaa --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInner.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "true" +// ERROR: Type mismatch.
Required:V
Found:kotlin.String
+// ERROR: An integer literal does not conform to the expected type U + +class B(val t: T) { + +} + +class A(val b: B) { + fun test() = b.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerPartialSubstitution.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerPartialSubstitution.kt new file mode 100644 index 00000000000..ad1bf45241e --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerPartialSubstitution.kt @@ -0,0 +1,10 @@ +// "Create class 'Foo'" "true" +// ERROR: Type mismatch.
Required:U
Found:kotlin.String
+ +class B(val t: T) { + +} + +class A(val b: B) { + fun test() = b.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerWithReceiverArg.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerWithReceiverArg.kt new file mode 100644 index 00000000000..399fbee707c --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerWithReceiverArg.kt @@ -0,0 +1,11 @@ +// "Create class 'Foo'" "true" +// ERROR: Type mismatch.
Required:W
Found:kotlin.String
+// ERROR: An integer literal does not conform to the expected type V + +class B(val t: T) { + +} + +class A(val b: B) { + fun test() = b.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberPartialSubstitution.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberPartialSubstitution.kt new file mode 100644 index 00000000000..353e16d957e --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberPartialSubstitution.kt @@ -0,0 +1,9 @@ +// "Create class 'Foo'" "true" + +class B(val t: T) { + +} + +class A(val b: B) { + fun test() = B.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeExtension.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeExtension.kt new file mode 100644 index 00000000000..d88160868a8 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeExtension.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "false" +// ACTION: Create function 'Foo' +// ERROR: Unresolved reference: Foo + +class A(val items: List) { + fun test() = items.Foo(2, "2") +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiver.kt new file mode 100644 index 00000000000..a709d61dcd6 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiver.kt @@ -0,0 +1,3 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverExtraArgs.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverExtraArgs.kt new file mode 100644 index 00000000000..82fc080b2c6 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverExtraArgs.kt @@ -0,0 +1,3 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverLongName.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverLongName.kt new file mode 100644 index 00000000000..90489c8b969 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverLongName.kt @@ -0,0 +1,3 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverPartialSubstitution.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverPartialSubstitution.kt new file mode 100644 index 00000000000..fe0a28f162f --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverPartialSubstitution.kt @@ -0,0 +1,3 @@ +// "Create class 'Foo'" "true" + +fun test() = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeWithExpectedTypeNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeWithExpectedTypeNoReceiver.kt new file mode 100644 index 00000000000..73d633f4865 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeWithExpectedTypeNoReceiver.kt @@ -0,0 +1,7 @@ +// "Create class 'Foo'" "true" + +open class A { + +} + +fun test(a: A): A = Foo(a, 1) \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallInAnnotationEntry.kt new file mode 100644 index 00000000000..3ccb7cd63d7 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallInAnnotationEntry.kt @@ -0,0 +1,8 @@ +// "Create function 'bar'" "false" +// ACTION: Create annotation 'bar' +// ERROR: Unresolved reference: foo +// ERROR: Unresolved reference: bar + +[foo(1, "2", bar("3", 4))] fun test() { + +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixMultiFileTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixMultiFileTestGenerated.java index a7cbe0dce1c..da15f343db0 100644 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixMultiFileTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixMultiFileTestGenerated.java @@ -230,13 +230,30 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes @TestMetadata("idea/testData/quickfix/createFromUsage/createClass") @TestDataPath("$PROJECT_ROOT") - @InnerTestClasses({}) + @InnerTestClasses({CreateClass.CallExpression.class}) @RunWith(JUnit3RunnerWithInners.class) public static class CreateClass extends AbstractQuickFixMultiFileTest { public void testAllFilesPresentInCreateClass() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createClass"), Pattern.compile("^(\\w+)\\.before\\.Main\\.kt$"), true); } + @TestMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({}) + @RunWith(JUnit3RunnerWithInners.class) + public static class CallExpression extends AbstractQuickFixMultiFileTest { + public void testAllFilesPresentInCallExpression() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createClass/callExpression"), Pattern.compile("^(\\w+)\\.before\\.Main\\.kt$"), true); + } + + @TestMetadata("callWithJavaClassReceiver.before.Main.kt") + public void testCallWithJavaClassReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithJavaClassReceiver.before.Main.kt"); + doTestWithExtraFile(fileName); + } + + } + } @TestMetadata("idea/testData/quickfix/createFromUsage/createFunction") diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java index 4de22d69d64..e63e731e4a3 100644 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java @@ -628,13 +628,278 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { @TestMetadata("idea/testData/quickfix/createFromUsage/createClass") @TestDataPath("$PROJECT_ROOT") - @InnerTestClasses({CreateClass.DelegationSpecifier.class, CreateClass.ImportDirective.class, CreateClass.ReferenceExpression.class, CreateClass.TypeReference.class}) + @InnerTestClasses({CreateClass.CallExpression.class, CreateClass.DelegationSpecifier.class, CreateClass.ImportDirective.class, CreateClass.ReferenceExpression.class, CreateClass.TypeReference.class}) @RunWith(JUnit3RunnerWithInners.class) public static class CreateClass extends AbstractQuickFixTest { public void testAllFilesPresentInCreateClass() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createClass"), Pattern.compile("^before(\\w+)\\.kt$"), true); } + @TestMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({CallExpression.TypeArguments.class}) + @RunWith(JUnit3RunnerWithInners.class) + public static class CallExpression extends AbstractQuickFixTest { + public void testAllFilesPresentInCallExpression() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createClass/callExpression"), Pattern.compile("^before(\\w+)\\.kt$"), true); + } + + @TestMetadata("beforeCallInAnnotationEntry.kt") + public void testCallInAnnotationEntry() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInAnnotationEntry.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallInLambda.kt") + public void testCallInLambda() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLambda.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallInLocalFunNoReceiver.kt") + public void testCallInLocalFunNoReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInLocalFunNoReceiver.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallInMemberFunNoReceiver.kt") + public void testCallInMemberFunNoReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberFunNoReceiver.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallInMemberValDelegateRuntime.kt") + public void testCallInMemberValDelegateRuntime() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberValDelegateRuntime.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallInMemberVarDelegateRuntime.kt") + public void testCallInMemberVarDelegateRuntime() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallInMemberVarDelegateRuntime.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallNoReceiver.kt") + public void testCallNoReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallNoReceiver.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithClassQualifier.kt") + public void testCallWithClassQualifier() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithClassQualifier.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithExplicitParamNames.kt") + public void testCallWithExplicitParamNames() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExplicitParamNames.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithExtraArgs.kt") + public void testCallWithExtraArgs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithExtraArgs.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithFinalSupertype.kt") + public void testCallWithFinalSupertype() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithFinalSupertype.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithGenericReceiver.kt") + public void testCallWithGenericReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithGenericReceiver.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithLambdaArg.kt") + public void testCallWithLambdaArg() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArg.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithLambdaArgOnly.kt") + public void testCallWithLambdaArgOnly() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArgOnly.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithLibClassQualifier.kt") + public void testCallWithLibClassQualifier() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLibClassQualifier.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithMissingArgs.kt") + public void testCallWithMissingArgs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithMissingArgs.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithObjectQualifier.kt") + public void testCallWithObjectQualifier() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithObjectQualifier.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithPackageName.kt") + public void testCallWithPackageName() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithPackageName.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithReceiver.kt") + public void testCallWithReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithReceiver.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithSuperclassNoConstructorParams.kt") + public void testCallWithSuperclassNoConstructorParams() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassNoConstructorParams.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithSuperclassWithConstructorParams.kt") + public void testCallWithSuperclassWithConstructorParams() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSuperclassWithConstructorParams.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithSupertrait.kt") + public void testCallWithSupertrait() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithSupertrait.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithThisReceiverInClass.kt") + public void testCallWithThisReceiverInClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInClass.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithThisReceiverInExtension.kt") + public void testCallWithThisReceiverInExtension() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInExtension.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithThisReceiverInNestedClass1.kt") + public void testCallWithThisReceiverInNestedClass1() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass1.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithThisReceiverInNestedClass2.kt") + public void testCallWithThisReceiverInNestedClass2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithThisReceiverInNestedClass2.kt"); + doTest(fileName); + } + + @TestMetadata("beforeCallWithTypeArgsInAnnotationEntry.kt") + public void testCallWithTypeArgsInAnnotationEntry() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithTypeArgsInAnnotationEntry.kt"); + doTest(fileName); + } + + @TestMetadata("beforeSingleArgCallInAnnotationEntry.kt") + public void testSingleArgCallInAnnotationEntry() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleArgCallInAnnotationEntry.kt"); + doTest(fileName); + } + + @TestMetadata("beforeSingleNamedArgCallInAnnotationEntry.kt") + public void testSingleNamedArgCallInAnnotationEntry() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeSingleNamedArgCallInAnnotationEntry.kt"); + doTest(fileName); + } + + @TestMetadata("beforeUnusedCallResult.kt") + public void testUnusedCallResult() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeUnusedCallResult.kt"); + doTest(fileName); + } + + @TestMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class TypeArguments extends AbstractQuickFixTest { + public void testAllFilesPresentInTypeArguments() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments"), Pattern.compile("^before(\\w+)\\.kt$"), true); + } + + @TestMetadata("beforeClassMember.kt") + public void testClassMember() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMember.kt"); + doTest(fileName); + } + + @TestMetadata("beforeClassMemberInner.kt") + public void testClassMemberInner() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInner.kt"); + doTest(fileName); + } + + @TestMetadata("beforeClassMemberInnerPartialSubstitution.kt") + public void testClassMemberInnerPartialSubstitution() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerPartialSubstitution.kt"); + doTest(fileName); + } + + @TestMetadata("beforeClassMemberInnerWithReceiverArg.kt") + public void testClassMemberInnerWithReceiverArg() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberInnerWithReceiverArg.kt"); + doTest(fileName); + } + + @TestMetadata("beforeClassMemberPartialSubstitution.kt") + public void testClassMemberPartialSubstitution() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeClassMemberPartialSubstitution.kt"); + doTest(fileName); + } + + @TestMetadata("beforeExtension.kt") + public void testExtension() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeExtension.kt"); + doTest(fileName); + } + + @TestMetadata("beforeNoReceiver.kt") + public void testNoReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiver.kt"); + doTest(fileName); + } + + @TestMetadata("beforeNoReceiverExtraArgs.kt") + public void testNoReceiverExtraArgs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverExtraArgs.kt"); + doTest(fileName); + } + + @TestMetadata("beforeNoReceiverLongName.kt") + public void testNoReceiverLongName() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverLongName.kt"); + doTest(fileName); + } + + @TestMetadata("beforeNoReceiverPartialSubstitution.kt") + public void testNoReceiverPartialSubstitution() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeNoReceiverPartialSubstitution.kt"); + doTest(fileName); + } + + @TestMetadata("beforeWithExpectedTypeNoReceiver.kt") + public void testWithExpectedTypeNoReceiver() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/beforeWithExpectedTypeNoReceiver.kt"); + doTest(fileName); + } + } + } + @TestMetadata("idea/testData/quickfix/createFromUsage/createClass/delegationSpecifier") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -1137,6 +1402,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/createFromUsage/createFunction/call"), Pattern.compile("^before(\\w+)\\.kt$"), true); } + @TestMetadata("beforeCallInAnnotationEntry.kt") + public void testCallInAnnotationEntry() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallInAnnotationEntry.kt"); + doTest(fileName); + } + @TestMetadata("beforeCallWithLambdaArg.kt") public void testCallWithLambdaArg() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallWithLambdaArg.kt");