"Create type parameter from usage": don't suggest for not extension property
#KT-33300 Fixed
This commit is contained in:
committed by
Dmitry Gridin
parent
68609401c4
commit
30c41e6720
+1
-1
@@ -109,7 +109,7 @@ fun getPossibleTypeParameterContainers(startFrom: PsiElement): List<KtTypeParame
|
||||
.filter {
|
||||
((it is KtClass && !it.isInterface() && it !is KtEnumEntry) ||
|
||||
it is KtNamedFunction ||
|
||||
(it is KtProperty && !it.isLocal) ||
|
||||
(it is KtProperty && !it.isLocal && it.receiverTypeReference != null) ||
|
||||
it is KtTypeAlias) && it.nameIdentifier != null
|
||||
}
|
||||
.toList()
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// "Create type parameter 'T' in property 'a'" "true"
|
||||
val T.a: <caret>T?
|
||||
get() = null
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// "Create type parameter 'T' in property 'a'" "true"
|
||||
val <T> T.a: T?
|
||||
get() = null
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create type parameter 'T' in property 'a'" "true"
|
||||
class Test {
|
||||
val T.a: <caret>T?
|
||||
get() = null
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create type parameter 'T' in property 'a'" "true"
|
||||
class Test {
|
||||
val <T> T.a: T?
|
||||
get() = null
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create type parameter 'T' in property 'a'" "true"
|
||||
val T.a: String
|
||||
get() {
|
||||
val b: T<caret>
|
||||
return ""
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create type parameter 'T' in property 'a'" "true"
|
||||
val <T> T.a: String
|
||||
get() {
|
||||
val b: T
|
||||
return ""
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// "Create type parameter 'T' in property 'a'" "false"
|
||||
// ACTION: Convert property initializer to getter
|
||||
// ACTION: Convert to lazy property
|
||||
// ACTION: Create annotation 'T'
|
||||
// ACTION: Create class 'T'
|
||||
// ACTION: Create enum 'T'
|
||||
// ACTION: Create interface 'T'
|
||||
// ACTION: Remove explicit type specification
|
||||
// ERROR: Unresolved reference: T
|
||||
val a: <caret>T? = null
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// "Create type parameter 'T' in property 'a'" "false"
|
||||
// ACTION: Convert property initializer to getter
|
||||
// ACTION: Convert to lazy property
|
||||
// ACTION: Create annotation 'T'
|
||||
// ACTION: Create class 'T'
|
||||
// ACTION: Create enum 'T'
|
||||
// ACTION: Create interface 'T'
|
||||
// ACTION: Create type parameter 'T' in class 'Test'
|
||||
// ACTION: Move to constructor
|
||||
// ACTION: Remove explicit type specification
|
||||
// ERROR: Unresolved reference: T
|
||||
class Test {
|
||||
val a: <caret>T? = null
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Create type parameter 'T' in property 'a'" "false"
|
||||
// ACTION: Create annotation 'T'
|
||||
// ACTION: Create class 'T'
|
||||
// ACTION: Create enum 'T'
|
||||
// ACTION: Create interface 'T'
|
||||
// ERROR: Unresolved reference: T
|
||||
val a = fun() {
|
||||
val b: T<caret>
|
||||
}
|
||||
@@ -4748,6 +4748,36 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
runTest("idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/inAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inExtensionProperty.kt")
|
||||
public void testInExtensionProperty() throws Exception {
|
||||
runTest("idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/inExtensionProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inExtensionProperty2.kt")
|
||||
public void testInExtensionProperty2() throws Exception {
|
||||
runTest("idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/inExtensionProperty2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inExtensionProperty3.kt")
|
||||
public void testInExtensionProperty3() throws Exception {
|
||||
runTest("idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/inExtensionProperty3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inProperty.kt")
|
||||
public void testInProperty() throws Exception {
|
||||
runTest("idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/inProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inProperty2.kt")
|
||||
public void testInProperty2() throws Exception {
|
||||
runTest("idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/inProperty2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inProperty3.kt")
|
||||
public void testInProperty3() throws Exception {
|
||||
runTest("idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/inProperty3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inSuperTypeEntry.kt")
|
||||
public void testInSuperTypeEntry() throws Exception {
|
||||
runTest("idea/testData/quickfix/createFromUsage/createTypeParameter/inContainingDeclaration/inSuperTypeEntry.kt");
|
||||
|
||||
Reference in New Issue
Block a user