From e4f80e277f1872725585bb9631ec644ee3a9b963 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Tue, 20 Sep 2016 22:42:19 +0300 Subject: [PATCH] Better texts of change variable type quickfixes --- .../idea/quickfix/ChangeVariableTypeFix.kt | 41 ++++++++++++++++--- .../wrongExpectedType.kt | 2 +- ...ChangeMultipleOverriddenPropertiesTypes.kt | 4 +- .../changeOverriddenPropertyType1.kt | 2 +- .../changeOverriddenPropertyType1.kt.after | 2 +- .../changeOverriddenPropertyType2.kt | 2 +- .../changeOverriddenPropertyType2.kt.after | 2 +- ...ngeOverridingPropertyTypeToFunctionType.kt | 2 +- ...rridingPropertyTypeToFunctionType.kt.after | 2 +- .../objectInsideBody.kt | 2 +- .../objectInsideBody.kt.after | 2 +- .../propertyReturnTypeMismatchOnOverride.kt | 2 +- ...pertyReturnTypeMismatchOnOverride.kt.after | 2 +- .../propertyTypeMismatchOnOverrideIntLong.kt | 2 +- ...ertyTypeMismatchOnOverrideIntLong.kt.after | 2 +- .../propertyTypeMismatchOnOverrideIntUnit.kt | 2 +- ...ertyTypeMismatchOnOverrideIntUnit.kt.after | 2 +- .../anonymousObjectInInitializer.kt | 2 +- .../anonymousObjectInInitializer.kt.after | 2 +- .../componentFunctionReturnTypeMismatch5.kt | 2 +- ...ponentFunctionReturnTypeMismatch5.kt.after | 2 +- ...ChangeOverriddenPropertyTypeToErrorType.kt | 4 +- .../typeMismatch/intToShortTypeMismatch.kt | 2 +- .../intToShortTypeMismatch.kt.after | 2 +- .../typeMismatch/longToDoubleTypeMismatch.kt | 2 +- .../longToDoubleTypeMismatch.kt.after | 2 +- .../typeMismatch/longToIntTypeMismatch.kt | 2 +- .../longToIntTypeMismatch.kt.after | 2 +- .../typeMismatch/propertyTypeMismatch.kt | 2 +- .../propertyTypeMismatch.kt.after | 2 +- .../propertyTypeMismatchLongNameRuntime.kt | 2 +- ...opertyTypeMismatchLongNameRuntime.kt.after | 2 +- .../typeMismatch/shortToByteTypeMismatch.kt | 2 +- .../shortToByteTypeMismatch.kt.after | 2 +- .../assignmentTypeMismatch.kt | 2 +- .../assignmentTypeMismatch.kt.after | 2 +- .../literalPropertyWithGetter.kt | 2 +- .../literalPropertyWithGetter.kt.after | 2 +- .../notApplicableToConstructor.kt | 4 +- .../propertyGetterInitializerTypeMismatch.kt | 2 +- ...ertyGetterInitializerTypeMismatch.kt.after | 2 +- ...eMismatchInIfStatementReturnedByLiteral.kt | 2 +- ...tchInIfStatementReturnedByLiteral.kt.after | 2 +- .../doubleToIntDecimalPlaces.kt | 2 +- .../wrongPrimitive/doubleToLongNotInRange.kt | 2 +- .../wrongPrimitive/doubleToShortNotInRange.kt | 2 +- 46 files changed, 84 insertions(+), 53 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeVariableTypeFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeVariableTypeFix.kt index 83e6f5c83b6..b77dab42535 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeVariableTypeFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeVariableTypeFix.kt @@ -16,10 +16,12 @@ package org.jetbrains.kotlin.idea.quickfix +import com.intellij.codeInsight.intention.HighPriorityAction import com.intellij.codeInsight.intention.IntentionAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.psi.PsiFile +import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.idea.KotlinBundle @@ -34,16 +36,45 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils import org.jetbrains.kotlin.types.ErrorUtils import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.checker.KotlinTypeChecker +import org.jetbrains.kotlin.utils.addToStdlib.check import java.util.* -class ChangeVariableTypeFix(element: KtVariableDeclaration, type: KotlinType) : KotlinQuickFixAction(element) { +open class ChangeVariableTypeFix(element: KtVariableDeclaration, type: KotlinType) : KotlinQuickFixAction(element) { private val typeContainsError = ErrorUtils.containsErrorType(type) private val typePresentation = IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_IN_TYPES.renderType(type) private val typeSourceCode = IdeDescriptorRenderers.SOURCE_CODE.renderType(type) + open fun variablePresentation(): String? { + val name = element.name + if (name != null) { + val container = element.resolveToDescriptor().containingDeclaration as? ClassDescriptor + val containerName = container?.name?.check { !it.isSpecial }?.asString() + return if (containerName != null) "'$containerName.$name'" else "'$name'" + } + else { + return null + } + } + override fun getText(): String { - val propertyName = element.fqName?.asString() ?: element.name - return "Change '$propertyName' type to '$typePresentation'" + val variablePresentation = variablePresentation() + if (variablePresentation != null) { + return "Change type of $variablePresentation to '$typePresentation'" + } + else { + return "Change type to '$typePresentation'" + } + } + + class OnType(element: KtVariableDeclaration, type: KotlinType) : ChangeVariableTypeFix(element, type), HighPriorityAction { + override fun variablePresentation() = null + } + + class ForOverridden(element: KtVariableDeclaration, type: KotlinType) : ChangeVariableTypeFix(element, type) { + override fun variablePresentation(): String? { + val presentation = super.variablePresentation() ?: return null + return "overridden property $presentation" + } } override fun getFamilyName() @@ -118,13 +149,13 @@ class ChangeVariableTypeFix(element: KtVariableDeclaration, type: KotlinType) : } if (lowerBoundOfOverriddenPropertiesTypes != null) { - actions.add(ChangeVariableTypeFix(property, lowerBoundOfOverriddenPropertiesTypes)) + actions.add(ChangeVariableTypeFix.OnType(property, lowerBoundOfOverriddenPropertiesTypes)) } if (overriddenMismatchingProperties.size == 1 && canChangeOverriddenPropertyType) { val overriddenProperty = DescriptorToSourceUtils.descriptorToDeclaration(overriddenMismatchingProperties.single()) if (overriddenProperty is KtProperty) { - actions.add(ChangeVariableTypeFix(overriddenProperty, propertyType)) + actions.add(ChangeVariableTypeFix.ForOverridden(overriddenProperty, propertyType)) } } } diff --git a/idea/testData/quickfix/createFromUsage/createSecondaryConstructor/wrongExpectedType.kt b/idea/testData/quickfix/createFromUsage/createSecondaryConstructor/wrongExpectedType.kt index 903b128a3de..c611030b85d 100644 --- a/idea/testData/quickfix/createFromUsage/createSecondaryConstructor/wrongExpectedType.kt +++ b/idea/testData/quickfix/createFromUsage/createSecondaryConstructor/wrongExpectedType.kt @@ -1,6 +1,6 @@ // "Create secondary constructor" "false" // ACTION: Add parameter to constructor 'A' -// ACTION: Change 'b' type to 'A' +// ACTION: Change type of 'b' to 'A' // ACTION: Create function 'A' // ERROR: Type mismatch: inferred type is A but B was expected // ERROR: Too many arguments for public constructor A() defined in A diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/cantChangeMultipleOverriddenPropertiesTypes.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/cantChangeMultipleOverriddenPropertiesTypes.kt index 893fc8280a6..98163105562 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/cantChangeMultipleOverriddenPropertiesTypes.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/cantChangeMultipleOverriddenPropertiesTypes.kt @@ -1,5 +1,5 @@ -// "Change 'A.x' type to '(Int) -> Int'" "false" -// ACTION: Change 'C.x' type to '(String) -> Int' +// "Change type of overriden property 'A.x' to '(Int) -> Int'" "false" +// ACTION: Change type to '(String) -> Int' // ERROR: Type of 'x' is not a subtype of the overridden property 'public abstract val x: (String) -> Int defined in A' interface A { val x: (String) -> Int diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType1.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType1.kt index fb4a20a54ca..5f954146d30 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType1.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType1.kt @@ -1,4 +1,4 @@ -// "Change 'B.x' type to '(Int) -> Int'" "true" +// "Change type of overridden property 'B.x' to '(Int) -> Int'" "true" interface A { val x: (Int) -> Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType1.kt.after b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType1.kt.after index 70c2748925f..ccb2141dc96 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType1.kt.after +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType1.kt.after @@ -1,4 +1,4 @@ -// "Change 'B.x' type to '(Int) -> Int'" "true" +// "Change type of overridden property 'B.x' to '(Int) -> Int'" "true" interface A { val x: (Int) -> Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType2.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType2.kt index 70db8cf0cfa..b206171cbb5 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType2.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType2.kt @@ -1,4 +1,4 @@ -// "Change 'A.x' type to 'String'" "true" +// "Change type of overridden property 'A.x' to 'String'" "true" interface A { var x: Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType2.kt.after b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType2.kt.after index 6a8e5af5742..dfa2e659506 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType2.kt.after +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverriddenPropertyType2.kt.after @@ -1,4 +1,4 @@ -// "Change 'A.x' type to 'String'" "true" +// "Change type of overridden property 'A.x' to 'String'" "true" interface A { var x: String } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverridingPropertyTypeToFunctionType.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverridingPropertyTypeToFunctionType.kt index 62252d5d257..3ecabb8a48b 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverridingPropertyTypeToFunctionType.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverridingPropertyTypeToFunctionType.kt @@ -1,4 +1,4 @@ -// "Change 'B.x' type to '(String) -> Int'" "true" +// "Change type to '(String) -> Int'" "true" interface A { var x: (String) -> Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverridingPropertyTypeToFunctionType.kt.after b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverridingPropertyTypeToFunctionType.kt.after index 830c4d30037..2e719f97f4a 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverridingPropertyTypeToFunctionType.kt.after +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/changeOverridingPropertyTypeToFunctionType.kt.after @@ -1,4 +1,4 @@ -// "Change 'B.x' type to '(String) -> Int'" "true" +// "Change type to '(String) -> Int'" "true" interface A { var x: (String) -> Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/objectInsideBody.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/objectInsideBody.kt index 962457d7ba2..83204370b0e 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/objectInsideBody.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/objectInsideBody.kt @@ -1,4 +1,4 @@ -// "Change 'prop' type to 'Int'" "true" +// "Change type to 'Int'" "true" // ERROR: Null can not be a value of a non-null type Int interface Test { val prop : T diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/objectInsideBody.kt.after b/idea/testData/quickfix/override/typeMismatchOnOverride/objectInsideBody.kt.after index 0aaa7117803..5b0332f87c9 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/objectInsideBody.kt.after +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/objectInsideBody.kt.after @@ -1,4 +1,4 @@ -// "Change 'prop' type to 'Int'" "true" +// "Change type to 'Int'" "true" // ERROR: Null can not be a value of a non-null type Int interface Test { val prop : T diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyReturnTypeMismatchOnOverride.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyReturnTypeMismatchOnOverride.kt index c8de1597a99..7e4ded6883c 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyReturnTypeMismatchOnOverride.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyReturnTypeMismatchOnOverride.kt @@ -1,4 +1,4 @@ -// "Change 'A.x' type to 'Int'" "true" +// "Change type to 'Int'" "true" interface X { val x: Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyReturnTypeMismatchOnOverride.kt.after b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyReturnTypeMismatchOnOverride.kt.after index 3b1c2c60650..d5b8f1e3773 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyReturnTypeMismatchOnOverride.kt.after +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyReturnTypeMismatchOnOverride.kt.after @@ -1,4 +1,4 @@ -// "Change 'A.x' type to 'Int'" "true" +// "Change type to 'Int'" "true" interface X { val x: Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntLong.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntLong.kt index a70d8d74a05..3a434bca3bb 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntLong.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntLong.kt @@ -1,4 +1,4 @@ -// "Change 'B.x' type to 'Int'" "true" +// "Change type to 'Int'" "true" abstract class A { abstract var x : Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntLong.kt.after b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntLong.kt.after index 80d3b2e6a05..e75ee15370c 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntLong.kt.after +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntLong.kt.after @@ -1,4 +1,4 @@ -// "Change 'B.x' type to 'Int'" "true" +// "Change type to 'Int'" "true" abstract class A { abstract var x : Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntUnit.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntUnit.kt index 469a62099b0..94cb2386cbe 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntUnit.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntUnit.kt @@ -1,4 +1,4 @@ -// "Change 'B.x' type to 'Int'" "true" +// "Change type to 'Int'" "true" abstract class A { abstract var x : Int } diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntUnit.kt.after b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntUnit.kt.after index f37ab4f9ff0..9c0f78ab10e 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntUnit.kt.after +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/propertyTypeMismatchOnOverrideIntUnit.kt.after @@ -1,4 +1,4 @@ -// "Change 'B.x' type to 'Int'" "true" +// "Change type to 'Int'" "true" abstract class A { abstract var x : Int } diff --git a/idea/testData/quickfix/typeMismatch/anonymousObjectInInitializer.kt b/idea/testData/quickfix/typeMismatch/anonymousObjectInInitializer.kt index f54fcd233ca..833576d5624 100644 --- a/idea/testData/quickfix/typeMismatch/anonymousObjectInInitializer.kt +++ b/idea/testData/quickfix/typeMismatch/anonymousObjectInInitializer.kt @@ -1,4 +1,4 @@ -// "Change 't' type to 'T'" "true" +// "Change type of 't' to 'T'" "true" interface T fun foo() { diff --git a/idea/testData/quickfix/typeMismatch/anonymousObjectInInitializer.kt.after b/idea/testData/quickfix/typeMismatch/anonymousObjectInInitializer.kt.after index db783117a4a..533420c6dd0 100644 --- a/idea/testData/quickfix/typeMismatch/anonymousObjectInInitializer.kt.after +++ b/idea/testData/quickfix/typeMismatch/anonymousObjectInInitializer.kt.after @@ -1,4 +1,4 @@ -// "Change 't' type to 'T'" "true" +// "Change type of 't' to 'T'" "true" interface T fun foo() { diff --git a/idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt b/idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt index 3160166aa1a..7d6d8f05774 100644 --- a/idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt +++ b/idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt @@ -1,4 +1,4 @@ -// "Change 'y' type to 'Int'" "true" +// "Change type of 'y' to 'Int'" "true" class A { operator fun component1() = 42 operator fun component2() = 42 diff --git a/idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt.after b/idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt.after index ea925d1d906..f85fe120bfd 100644 --- a/idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt.after +++ b/idea/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt.after @@ -1,4 +1,4 @@ -// "Change 'y' type to 'Int'" "true" +// "Change type of 'y' to 'Int'" "true" class A { operator fun component1() = 42 operator fun component2() = 42 diff --git a/idea/testData/quickfix/typeMismatch/dontChangeOverriddenPropertyTypeToErrorType.kt b/idea/testData/quickfix/typeMismatch/dontChangeOverriddenPropertyTypeToErrorType.kt index 6635d0742ee..8a020de670c 100644 --- a/idea/testData/quickfix/typeMismatch/dontChangeOverriddenPropertyTypeToErrorType.kt +++ b/idea/testData/quickfix/typeMismatch/dontChangeOverriddenPropertyTypeToErrorType.kt @@ -1,5 +1,5 @@ -// "Change 'B.x' type to '(String) -> [ERROR : Ay]'" "false" -// ACTION: Change 'A.x' type to '(Int) -> Int' +// "Change type to '(String) -> [ERROR : Ay]'" "false" +// ACTION: Change type of overridden property 'A.x' to '(Int) -> Int' // ERROR: Type of 'x' is not a subtype of the overridden property 'public abstract val x: (String) -> [ERROR : Ay] defined in A' // ERROR: Unresolved reference: Ay interface A { diff --git a/idea/testData/quickfix/typeMismatch/intToShortTypeMismatch.kt b/idea/testData/quickfix/typeMismatch/intToShortTypeMismatch.kt index 5cf2305b739..eeb29faeaa6 100644 --- a/idea/testData/quickfix/typeMismatch/intToShortTypeMismatch.kt +++ b/idea/testData/quickfix/typeMismatch/intToShortTypeMismatch.kt @@ -1,4 +1,4 @@ -// "Change 'x' type to 'Int'" "true" +// "Change type of 'x' to 'Int'" "true" fun foo() { val x: Short = 100000 diff --git a/idea/testData/quickfix/typeMismatch/intToShortTypeMismatch.kt.after b/idea/testData/quickfix/typeMismatch/intToShortTypeMismatch.kt.after index 7b7ccd94d83..630bba30eb0 100644 --- a/idea/testData/quickfix/typeMismatch/intToShortTypeMismatch.kt.after +++ b/idea/testData/quickfix/typeMismatch/intToShortTypeMismatch.kt.after @@ -1,4 +1,4 @@ -// "Change 'x' type to 'Int'" "true" +// "Change type of 'x' to 'Int'" "true" fun foo() { val x: Int = 100000 diff --git a/idea/testData/quickfix/typeMismatch/longToDoubleTypeMismatch.kt b/idea/testData/quickfix/typeMismatch/longToDoubleTypeMismatch.kt index 46e57f7bb5d..c5c0e18bfcc 100644 --- a/idea/testData/quickfix/typeMismatch/longToDoubleTypeMismatch.kt +++ b/idea/testData/quickfix/typeMismatch/longToDoubleTypeMismatch.kt @@ -1,4 +1,4 @@ -// "Change 'x' type to 'Long'" "true" +// "Change type of 'x' to 'Long'" "true" fun foo() { val x: Double = 0L diff --git a/idea/testData/quickfix/typeMismatch/longToDoubleTypeMismatch.kt.after b/idea/testData/quickfix/typeMismatch/longToDoubleTypeMismatch.kt.after index f8755845879..dc132b8e766 100644 --- a/idea/testData/quickfix/typeMismatch/longToDoubleTypeMismatch.kt.after +++ b/idea/testData/quickfix/typeMismatch/longToDoubleTypeMismatch.kt.after @@ -1,4 +1,4 @@ -// "Change 'x' type to 'Long'" "true" +// "Change type of 'x' to 'Long'" "true" fun foo() { val x: Long = 0L diff --git a/idea/testData/quickfix/typeMismatch/longToIntTypeMismatch.kt b/idea/testData/quickfix/typeMismatch/longToIntTypeMismatch.kt index 68314be4e16..d6288e08b64 100644 --- a/idea/testData/quickfix/typeMismatch/longToIntTypeMismatch.kt +++ b/idea/testData/quickfix/typeMismatch/longToIntTypeMismatch.kt @@ -1,4 +1,4 @@ -// "Change 'x' type to 'Long'" "true" +// "Change type of 'x' to 'Long'" "true" fun foo() { val x: Int = 0L diff --git a/idea/testData/quickfix/typeMismatch/longToIntTypeMismatch.kt.after b/idea/testData/quickfix/typeMismatch/longToIntTypeMismatch.kt.after index f8755845879..dc132b8e766 100644 --- a/idea/testData/quickfix/typeMismatch/longToIntTypeMismatch.kt.after +++ b/idea/testData/quickfix/typeMismatch/longToIntTypeMismatch.kt.after @@ -1,4 +1,4 @@ -// "Change 'x' type to 'Long'" "true" +// "Change type of 'x' to 'Long'" "true" fun foo() { val x: Long = 0L diff --git a/idea/testData/quickfix/typeMismatch/propertyTypeMismatch.kt b/idea/testData/quickfix/typeMismatch/propertyTypeMismatch.kt index 57484fa75c1..196e8961768 100644 --- a/idea/testData/quickfix/typeMismatch/propertyTypeMismatch.kt +++ b/idea/testData/quickfix/typeMismatch/propertyTypeMismatch.kt @@ -1,4 +1,4 @@ -// "Change 'f' type to '(Long) -> Unit'" "true" +// "Change type of 'f' to '(Long) -> Unit'" "true" fun foo() { var f: Int = if (true) { x: Long -> } else { x: Long -> } } \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/propertyTypeMismatch.kt.after b/idea/testData/quickfix/typeMismatch/propertyTypeMismatch.kt.after index 032a1cceff1..384b5ccb010 100644 --- a/idea/testData/quickfix/typeMismatch/propertyTypeMismatch.kt.after +++ b/idea/testData/quickfix/typeMismatch/propertyTypeMismatch.kt.after @@ -1,4 +1,4 @@ -// "Change 'f' type to '(Long) -> Unit'" "true" +// "Change type of 'f' to '(Long) -> Unit'" "true" fun foo() { var f: (Long) -> Unit = if (true) { x: Long -> } else { x: Long -> } } \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/propertyTypeMismatchLongNameRuntime.kt b/idea/testData/quickfix/typeMismatch/propertyTypeMismatchLongNameRuntime.kt index b6ccd0b3bfc..9b295e75922 100644 --- a/idea/testData/quickfix/typeMismatch/propertyTypeMismatchLongNameRuntime.kt +++ b/idea/testData/quickfix/typeMismatch/propertyTypeMismatchLongNameRuntime.kt @@ -1,4 +1,4 @@ -// "Change 'f' type to '(Delegates) -> Unit'" "true" +// "Change type of 'f' to '(Delegates) -> Unit'" "true" fun foo() { var f: Int = { x: kotlin.properties.Delegates -> } diff --git a/idea/testData/quickfix/typeMismatch/propertyTypeMismatchLongNameRuntime.kt.after b/idea/testData/quickfix/typeMismatch/propertyTypeMismatchLongNameRuntime.kt.after index c1ef6ac5481..36400684bbd 100644 --- a/idea/testData/quickfix/typeMismatch/propertyTypeMismatchLongNameRuntime.kt.after +++ b/idea/testData/quickfix/typeMismatch/propertyTypeMismatchLongNameRuntime.kt.after @@ -1,6 +1,6 @@ import kotlin.properties.Delegates -// "Change 'f' type to '(Delegates) -> Unit'" "true" +// "Change type of 'f' to '(Delegates) -> Unit'" "true" fun foo() { var f: (Delegates) -> Unit = { x: kotlin.properties.Delegates -> } diff --git a/idea/testData/quickfix/typeMismatch/shortToByteTypeMismatch.kt b/idea/testData/quickfix/typeMismatch/shortToByteTypeMismatch.kt index decc6425564..e8d33f14282 100644 --- a/idea/testData/quickfix/typeMismatch/shortToByteTypeMismatch.kt +++ b/idea/testData/quickfix/typeMismatch/shortToByteTypeMismatch.kt @@ -1,4 +1,4 @@ -// "Change 'x' type to 'Int'" "true" +// "Change type of 'x' to 'Int'" "true" fun foo() { val x: Byte = 1000 diff --git a/idea/testData/quickfix/typeMismatch/shortToByteTypeMismatch.kt.after b/idea/testData/quickfix/typeMismatch/shortToByteTypeMismatch.kt.after index 79d0cc77ea1..d7511b856dd 100644 --- a/idea/testData/quickfix/typeMismatch/shortToByteTypeMismatch.kt.after +++ b/idea/testData/quickfix/typeMismatch/shortToByteTypeMismatch.kt.after @@ -1,4 +1,4 @@ -// "Change 'x' type to 'Int'" "true" +// "Change type of 'x' to 'Int'" "true" fun foo() { val x: Int = 1000 diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/assignmentTypeMismatch.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/assignmentTypeMismatch.kt index ad45d53e8c7..0d3ed11bf0b 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/assignmentTypeMismatch.kt +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/assignmentTypeMismatch.kt @@ -1,4 +1,4 @@ -// "Change 'f' type to '() -> Unit'" "true" +// "Change type of 'f' to '() -> Unit'" "true" fun foo() { val f: () -> Int = { var x = 1 diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/assignmentTypeMismatch.kt.after b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/assignmentTypeMismatch.kt.after index ac73a6453e9..397fa0eef5f 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/assignmentTypeMismatch.kt.after +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/assignmentTypeMismatch.kt.after @@ -1,4 +1,4 @@ -// "Change 'f' type to '() -> Unit'" "true" +// "Change type of 'f' to '() -> Unit'" "true" fun foo() { val f: () -> Unit = { var x = 1 diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/literalPropertyWithGetter.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/literalPropertyWithGetter.kt index 252c3229bf2..3d42263b312 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/literalPropertyWithGetter.kt +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/literalPropertyWithGetter.kt @@ -1,4 +1,4 @@ -// "Change 'complex' type to '(Int) -> Long'" "true" +// "Change type of 'complex' to '(Int) -> Long'" "true" val complex: (Int) -> String get() = { it.toLong() } \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/literalPropertyWithGetter.kt.after b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/literalPropertyWithGetter.kt.after index 059e185d4ba..a616495e321 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/literalPropertyWithGetter.kt.after +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/literalPropertyWithGetter.kt.after @@ -1,4 +1,4 @@ -// "Change 'complex' type to '(Int) -> Long'" "true" +// "Change type of 'complex' to '(Int) -> Long'" "true" val complex: (Int) -> Long get() = { it.toLong() } \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/notApplicableToConstructor.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/notApplicableToConstructor.kt index f93209b86db..8cfe9e7924c 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/notApplicableToConstructor.kt +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/notApplicableToConstructor.kt @@ -1,5 +1,5 @@ -// "Change 'A' function return type to 'B'" "false" -// ACTION: Change 'b' type to 'A' +// "class org.jetbrains.kotlin.idea.quickfix.ChangeFunctionReturnTypeFix" "false" +// ACTION: Change type of 'b' to 'A' // ACTION: Convert property initializer to getter // ACTION: Let 'A' implement interface 'B' // ERROR: Type mismatch: inferred type is A but B was expected diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/propertyGetterInitializerTypeMismatch.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/propertyGetterInitializerTypeMismatch.kt index c9196877276..a7968ffdd81 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/propertyGetterInitializerTypeMismatch.kt +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/propertyGetterInitializerTypeMismatch.kt @@ -1,4 +1,4 @@ -// "Change 'A.x' type to '() -> Int'" "true" +// "Change type of 'A.x' to '() -> Int'" "true" class A { var x: Int get(): Int = if (true) { {42} } else { {24} } diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/propertyGetterInitializerTypeMismatch.kt.after b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/propertyGetterInitializerTypeMismatch.kt.after index e22fc7027ef..739a3358e0e 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/propertyGetterInitializerTypeMismatch.kt.after +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/propertyGetterInitializerTypeMismatch.kt.after @@ -1,4 +1,4 @@ -// "Change 'A.x' type to '() -> Int'" "true" +// "Change type of 'A.x' to '() -> Int'" "true" class A { var x: () -> Int get(): () -> Int = if (true) { {42} } else { {24} } diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/typeMismatchInIfStatementReturnedByLiteral.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/typeMismatchInIfStatementReturnedByLiteral.kt index 86fcfee1ac3..358ef194410 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/typeMismatchInIfStatementReturnedByLiteral.kt +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/typeMismatchInIfStatementReturnedByLiteral.kt @@ -1,4 +1,4 @@ -// "Change 'f' type to '(Int, Int) -> (String) -> Int'" "true" +// "Change type of 'f' to '(Int, Int) -> (String) -> Int'" "true" fun foo() { val f: () -> Long = { a: Int, b: Int -> diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/typeMismatchInIfStatementReturnedByLiteral.kt.after b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/typeMismatchInIfStatementReturnedByLiteral.kt.after index 26285651757..303e296c979 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/typeMismatchInIfStatementReturnedByLiteral.kt.after +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/typeMismatchInIfStatementReturnedByLiteral.kt.after @@ -1,4 +1,4 @@ -// "Change 'f' type to '(Int, Int) -> (String) -> Int'" "true" +// "Change type of 'f' to '(Int, Int) -> (String) -> Int'" "true" fun foo() { val f: (Int, Int) -> (String) -> Int = { a: Int, b: Int -> diff --git a/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToIntDecimalPlaces.kt b/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToIntDecimalPlaces.kt index 29dad0f6b10..0158dca1136 100644 --- a/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToIntDecimalPlaces.kt +++ b/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToIntDecimalPlaces.kt @@ -1,6 +1,6 @@ // "Change to '1'" "false" // ACTION: Add 'const' modifier -// ACTION: Change 'a' type to 'Double' +// ACTION: Change type of 'a' to 'Double' // ACTION: Convert expression to 'Int' // ACTION: Convert property initializer to getter // ERROR: The floating-point literal does not conform to the expected type Int diff --git a/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToLongNotInRange.kt b/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToLongNotInRange.kt index 9dc0eeef54c..3d94f9ed818 100644 --- a/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToLongNotInRange.kt +++ b/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToLongNotInRange.kt @@ -1,6 +1,6 @@ // "Change to '10000000000000000000L'" "false" // ACTION: Add 'const' modifier -// ACTION: Change 'a' type to 'Double' +// ACTION: Change type of 'a' to 'Double' // ACTION: Convert expression to 'Long' // ACTION: Convert property initializer to getter // ERROR: The floating-point literal does not conform to the expected type Long diff --git a/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToShortNotInRange.kt b/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToShortNotInRange.kt index 8cec6ba72a5..fde49366c5c 100644 --- a/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToShortNotInRange.kt +++ b/idea/testData/quickfix/typeMismatch/wrongPrimitive/doubleToShortNotInRange.kt @@ -1,6 +1,6 @@ // "Change to '65000'" "false" // ACTION: Add 'const' modifier -// ACTION: Change 'a' type to 'Double' +// ACTION: Change type of 'a' to 'Double' // ACTION: Convert expression to 'Short' // ACTION: Convert property initializer to getter // ERROR: The floating-point literal does not conform to the expected type Short