From ac7e955d3e7a0450b653effe713b4377607d8a37 Mon Sep 17 00:00:00 2001 From: Toshiaki Kameyama Date: Sat, 28 Sep 2019 08:51:10 +0900 Subject: [PATCH] Change parameter type quick fix: don't use qualified name #KT-32012 Fixed --- .../jetbrains/kotlin/idea/quickfix/ChangeParameterTypeFix.kt | 2 +- .../fixOverloadedOperator/changeTimesFunctionParameterType.kt | 2 +- .../changeTimesFunctionParameterType.kt.after | 2 +- .../typeMismatch/letClassImplementGenericInterfaceTwice.kt | 2 +- .../typeMismatch/letClassImplementGenericStarInterface.kt | 2 +- .../letClassImplementIndirectlyInheritedInterface.kt | 2 +- .../quickfix/typeMismatch/letStringImplementInterface.kt | 2 +- .../parameterTypeMismatch/changeFunctionParameterType1.kt | 2 +- .../parameterTypeMismatch/changeFunctionParameterType1.kt.after | 2 +- .../parameterTypeMismatch/changeParameterTypeLongNameRuntime.kt | 2 +- .../changeParameterTypeLongNameRuntime.kt.after | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeParameterTypeFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeParameterTypeFix.kt index bf6e6e69c91..9d6a5d60c0d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeParameterTypeFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeParameterTypeFix.kt @@ -42,7 +42,7 @@ class ChangeParameterTypeFix(element: KtParameter, type: KotlinType) : KotlinQui init { val declaration = PsiTreeUtil.getParentOfType(element, KtNamedDeclaration::class.java) - this.containingDeclarationName = declaration?.fqName?.asString() ?: declaration?.name + this.containingDeclarationName = declaration?.name this.isPrimaryConstructorParameter = declaration is KtPrimaryConstructor } diff --git a/idea/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt b/idea/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt index 5bed2b41d00..616a7d94261 100644 --- a/idea/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt +++ b/idea/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt @@ -1,4 +1,4 @@ -// "Change parameter 'a' type of function 'A.times' to 'String'" "true" +// "Change parameter 'a' type of function 'times' to 'String'" "true" interface A { operator fun times(a: A): A } diff --git a/idea/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt.after b/idea/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt.after index 0de4ca504ad..8ac62263afd 100644 --- a/idea/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt.after +++ b/idea/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt.after @@ -1,4 +1,4 @@ -// "Change parameter 'a' type of function 'A.times' to 'String'" "true" +// "Change parameter 'a' type of function 'times' to 'String'" "true" interface A { operator fun times(a: String): A } diff --git a/idea/testData/quickfix/typeMismatch/letClassImplementGenericInterfaceTwice.kt b/idea/testData/quickfix/typeMismatch/letClassImplementGenericInterfaceTwice.kt index e27c8dcc638..3cb4507872b 100644 --- a/idea/testData/quickfix/typeMismatch/letClassImplementGenericInterfaceTwice.kt +++ b/idea/testData/quickfix/typeMismatch/letClassImplementGenericInterfaceTwice.kt @@ -1,5 +1,5 @@ // "Let 'B' implement interface 'A'" "false" -// ACTION: Change parameter 'a' type of function 'let.implement.foo' to 'B' +// ACTION: Change parameter 'a' type of function 'foo' to 'B' // ACTION: Create function 'foo' // ERROR: Type mismatch: inferred type is B but A was expected package let.implement diff --git a/idea/testData/quickfix/typeMismatch/letClassImplementGenericStarInterface.kt b/idea/testData/quickfix/typeMismatch/letClassImplementGenericStarInterface.kt index 2bbb12525b5..f41c86fcac4 100644 --- a/idea/testData/quickfix/typeMismatch/letClassImplementGenericStarInterface.kt +++ b/idea/testData/quickfix/typeMismatch/letClassImplementGenericStarInterface.kt @@ -1,5 +1,5 @@ // "Let 'B' implement interface 'A<*>'" "false" -// ACTION: Change parameter 'a' type of function 'let.implement.foo' to 'B' +// ACTION: Change parameter 'a' type of function 'foo' to 'B' // ACTION: Create function 'foo' // ERROR: Type mismatch: inferred type is B but A<*> was expected diff --git a/idea/testData/quickfix/typeMismatch/letClassImplementIndirectlyInheritedInterface.kt b/idea/testData/quickfix/typeMismatch/letClassImplementIndirectlyInheritedInterface.kt index fe45afab10e..ca3ab9bb892 100644 --- a/idea/testData/quickfix/typeMismatch/letClassImplementIndirectlyInheritedInterface.kt +++ b/idea/testData/quickfix/typeMismatch/letClassImplementIndirectlyInheritedInterface.kt @@ -1,5 +1,5 @@ // "Let 'B' implement interface 'A'" "false" -// ACTION: Change parameter 'a' type of function 'let.implement.foo' to 'B' +// ACTION: Change parameter 'a' type of function 'foo' to 'B' // ACTION: Create function 'foo' // ERROR: Type mismatch: inferred type is B but A was expected package let.implement diff --git a/idea/testData/quickfix/typeMismatch/letStringImplementInterface.kt b/idea/testData/quickfix/typeMismatch/letStringImplementInterface.kt index 72c77595cf7..ac3fc7a4239 100644 --- a/idea/testData/quickfix/typeMismatch/letStringImplementInterface.kt +++ b/idea/testData/quickfix/typeMismatch/letStringImplementInterface.kt @@ -1,5 +1,5 @@ // "Let 'String' implement interface 'A'" "false" -// ACTION: Change parameter 'a' type of function 'let.implement.foo' to 'String' +// ACTION: Change parameter 'a' type of function 'foo' to 'String' // ACTION: To raw string literal // ACTION: Create function 'foo' // ERROR: Type mismatch: inferred type is String but A was expected diff --git a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType1.kt b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType1.kt index f3bcc3a1ebf..a2da6389f8d 100644 --- a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType1.kt +++ b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType1.kt @@ -1,4 +1,4 @@ -// "Change parameter 'x' type of function 'bar.foo' to '(String) -> Int'" "true" +// "Change parameter 'x' type of function 'foo' to '(String) -> Int'" "true" package bar fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> Int = {42}) { foo(1, { a: String -> 42}, 1) diff --git a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType1.kt.after b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType1.kt.after index 3812beed7ec..a4f803ad453 100644 --- a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType1.kt.after +++ b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType1.kt.after @@ -1,4 +1,4 @@ -// "Change parameter 'x' type of function 'bar.foo' to '(String) -> Int'" "true" +// "Change parameter 'x' type of function 'foo' to '(String) -> Int'" "true" package bar fun foo(w: Int = 0, x: (String) -> Int, y: Int = 0, z: (Int) -> Int = {42}) { foo(1, { a: String -> 42}, 1) diff --git a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeParameterTypeLongNameRuntime.kt b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeParameterTypeLongNameRuntime.kt index f1ce5c68525..dd47f84e20f 100644 --- a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeParameterTypeLongNameRuntime.kt +++ b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeParameterTypeLongNameRuntime.kt @@ -1,4 +1,4 @@ -// "Change parameter 'x' type of function 'bar.foo' to '(HashSet) -> Int'" "true" +// "Change parameter 'x' type of function 'foo' to '(HashSet) -> Int'" "true" package bar fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> Int = {42}) { foo(1, { a: java.util.HashSet -> 42}, 1) diff --git a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeParameterTypeLongNameRuntime.kt.after b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeParameterTypeLongNameRuntime.kt.after index eb6d84bc2bd..786e1295f67 100644 --- a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeParameterTypeLongNameRuntime.kt.after +++ b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeParameterTypeLongNameRuntime.kt.after @@ -1,4 +1,4 @@ -// "Change parameter 'x' type of function 'bar.foo' to '(HashSet) -> Int'" "true" +// "Change parameter 'x' type of function 'foo' to '(HashSet) -> Int'" "true" package bar import java.util.HashSet