Change parameter type quick fix: don't use qualified name
#KT-32012 Fixed
This commit is contained in:
committed by
Dmitry Gridin
parent
c463fad3b7
commit
ac7e955d3e
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Let 'B' implement interface 'A<Int>'" "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<Int> was expected
|
||||
package let.implement
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Let 'B' implement interface 'A<Int>'" "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<Int> was expected
|
||||
package let.implement
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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}<caret>, 1)
|
||||
|
||||
Vendored
+1
-1
@@ -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}<caret>, 1)
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change parameter 'x' type of function 'bar.foo' to '(HashSet<Int>) -> Int'" "true"
|
||||
// "Change parameter 'x' type of function 'foo' to '(HashSet<Int>) -> Int'" "true"
|
||||
package bar
|
||||
fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> Int = {42}) {
|
||||
foo(1, { a: java.util.HashSet<Int> -> 42}<caret>, 1)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change parameter 'x' type of function 'bar.foo' to '(HashSet<Int>) -> Int'" "true"
|
||||
// "Change parameter 'x' type of function 'foo' to '(HashSet<Int>) -> Int'" "true"
|
||||
package bar
|
||||
|
||||
import java.util.HashSet
|
||||
|
||||
Reference in New Issue
Block a user