Create from Usage: Implement "Create type parameter" quickfix
#KT-11525 Fixed
This commit is contained in:
idea/testData/quickfix/createFromUsage/createClass/delegationSpecifier/classDelegatorToSuperclass.kt
Vendored
+1
@@ -1,6 +1,7 @@
|
||||
// "Create class 'A'" "false"
|
||||
// ACTION: Create interface 'A'
|
||||
// ACTION: Create type alias 'A'
|
||||
// ACTION: Create type parameter 'A' in class 'Foo'
|
||||
// ACTION: Create test
|
||||
// ERROR: Unresolved reference: A
|
||||
package p
|
||||
|
||||
Vendored
+1
@@ -6,6 +6,7 @@
|
||||
// ACTION: Create type alias 'A'
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Remove explicit type specification
|
||||
// ACTION: Create type parameter 'A' in function 'foo'
|
||||
// ERROR: Unresolved reference: A
|
||||
package p
|
||||
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// ACTION: Create class 'NotExistent'
|
||||
// ACTION: Create interface 'NotExistent'
|
||||
// ACTION: Create type alias 'NotExistent'
|
||||
// ACTION: Create type parameter 'NotExistent' in class 'TPB'
|
||||
// ACTION: Create test
|
||||
// ERROR: Unresolved reference: NotExistent
|
||||
class TPB<X : <caret>NotExistent>
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// ACTION: Create class 'NotExistent'
|
||||
// ACTION: Create interface 'NotExistent'
|
||||
// ACTION: Create type alias 'NotExistent'
|
||||
// ACTION: Create type parameter 'NotExistent' in class 'TPB'
|
||||
// ACTION: Create test
|
||||
// ERROR: Unresolved reference: NotExistent
|
||||
class TPB<X> where X : <caret>NotExistent
|
||||
+1
@@ -2,6 +2,7 @@
|
||||
// ACTION: Create class 'NotExistent'
|
||||
// ACTION: Create interface 'NotExistent'
|
||||
// ACTION: Create type alias 'NotExistent'
|
||||
// ACTION: Create type parameter 'NotExistent' in class 'TPB'
|
||||
// ACTION: Create test
|
||||
// ERROR: Unresolved reference: NotExistent
|
||||
class TPB<X : <caret>NotExistent>
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// ACTION: Create class 'NotExistent'
|
||||
// ACTION: Create interface 'NotExistent'
|
||||
// ACTION: Create type alias 'NotExistent'
|
||||
// ACTION: Create type parameter 'NotExistent' in class 'TPB'
|
||||
// ACTION: Create test
|
||||
// ERROR: Unresolved reference: NotExistent
|
||||
class TPB<X> where X : <caret>NotExistent
|
||||
+1
@@ -2,6 +2,7 @@
|
||||
// ACTION: Create class 'NotExistent'
|
||||
// ACTION: Create interface 'NotExistent'
|
||||
// ACTION: Create type alias 'NotExistent'
|
||||
// ACTION: Create type parameter 'NotExistent' in class 'TPB'
|
||||
// ACTION: Create test
|
||||
// ERROR: Unresolved reference: NotExistent
|
||||
class TPB<X : <caret>NotExistent>
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// ACTION: Create class 'NotExistent'
|
||||
// ACTION: Create interface 'NotExistent'
|
||||
// ACTION: Create type alias 'NotExistent'
|
||||
// ACTION: Create type parameter 'NotExistent' in class 'TPB'
|
||||
// ACTION: Create test
|
||||
// ERROR: Unresolved reference: NotExistent
|
||||
class TPB<X> where X : <caret>NotExistent
|
||||
Vendored
+1
@@ -6,6 +6,7 @@
|
||||
// ACTION: Create type alias 'A'
|
||||
// ACTION: Convert to block body
|
||||
// ACTION: Remove explicit type specification
|
||||
// ACTION: Create type parameter 'A' in function 'foo'
|
||||
// ERROR: Unresolved reference: A
|
||||
package p
|
||||
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create type parameter 'X' in class 'Foo'" "true"
|
||||
open class Foo(x: <caret>X)
|
||||
|
||||
class Bar : Foo(1)
|
||||
|
||||
fun test() {
|
||||
Foo(1)
|
||||
Foo("2")
|
||||
|
||||
object : Foo("2") {
|
||||
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create type parameter 'X' in class 'Foo'" "true"
|
||||
open class Foo<X>(x: X)
|
||||
|
||||
class Bar : Foo<Any?>(1)
|
||||
|
||||
fun test() {
|
||||
Foo(1)
|
||||
Foo("2")
|
||||
|
||||
object : Foo<Any?>("2") {
|
||||
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Create type parameter 'X' in class 'Foo'" "true"
|
||||
// ERROR: Type mismatch: inferred type is A<Int> but A<Any?> was expected
|
||||
class A<T>
|
||||
|
||||
open class Foo(x: A<<caret>X>)
|
||||
|
||||
class Bar : Foo(A())
|
||||
|
||||
fun test() {
|
||||
Foo(A())
|
||||
Foo(A<Int>())
|
||||
|
||||
object : Foo(A<Int>()) {
|
||||
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Create type parameter 'X' in class 'Foo'" "true"
|
||||
// ERROR: Type mismatch: inferred type is A<Int> but A<Any?> was expected
|
||||
class A<T>
|
||||
|
||||
open class Foo<X>(x: A<X>)
|
||||
|
||||
class Bar : Foo<Any?>(A())
|
||||
|
||||
fun test() {
|
||||
Foo<Any?>(A())
|
||||
Foo(A<Int>())
|
||||
|
||||
object : Foo<Any?>(A<Int>()) {
|
||||
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// "Create type parameter 'X' in class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: _
|
||||
// ERROR: Unresolved reference: _
|
||||
// ERROR: Unresolved reference: _
|
||||
// ERROR: Type mismatch: inferred type is A<I> but A<List<[ERROR : _]>> was expected
|
||||
class A<T : List<T>>
|
||||
|
||||
interface I : List<I>
|
||||
|
||||
open class Foo(x: A<<caret>X>)
|
||||
|
||||
class Bar : Foo(A())
|
||||
|
||||
fun test() {
|
||||
Foo(A())
|
||||
Foo(A<I>())
|
||||
|
||||
object : Foo(A<I>()) {
|
||||
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// "Create type parameter 'X' in class 'Foo'" "true"
|
||||
// ERROR: Unresolved reference: _
|
||||
// ERROR: Unresolved reference: _
|
||||
// ERROR: Unresolved reference: _
|
||||
// ERROR: Type mismatch: inferred type is A<I> but A<List<[ERROR : _]>> was expected
|
||||
class A<T : List<T>>
|
||||
|
||||
interface I : List<I>
|
||||
|
||||
open class Foo<X : List<X>>(x: A<X>)
|
||||
|
||||
class Bar : Foo<List<_>>(A())
|
||||
|
||||
fun test() {
|
||||
Foo<List<_>>(A())
|
||||
Foo(A<I>())
|
||||
|
||||
object : Foo<List<_>>(A<I>()) {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// "Create type parameter 'X' in class 'Foo'" "true"
|
||||
class A<T : List<Int>>
|
||||
|
||||
open class Foo(x: A<<caret>X>)
|
||||
|
||||
class Bar : Foo(A())
|
||||
|
||||
fun test() {
|
||||
Foo(A())
|
||||
Foo(A<List<Int>>())
|
||||
|
||||
object : Foo(A<List<Int>>()) {
|
||||
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Create type parameter 'X' in class 'Foo'" "true"
|
||||
class A<T : List<Int>>
|
||||
|
||||
open class Foo<X : List<Int>>(x: A<X>)
|
||||
|
||||
class Bar : Foo<List<Int>>(A())
|
||||
|
||||
fun test() {
|
||||
Foo<List<Int>>(A())
|
||||
Foo(A<List<Int>>())
|
||||
|
||||
object : Foo<List<Int>>(A<List<Int>>()) {
|
||||
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create type parameter 'X' in function 'foo'" "true"
|
||||
fun foo(x: <caret>X) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
foo(1)
|
||||
foo("2")
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create type parameter 'X' in function 'foo'" "true"
|
||||
fun <X> foo(x: X) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
foo(1)
|
||||
foo("2")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create type parameter 'X' in function 'foo'" "true"
|
||||
class A<T>
|
||||
|
||||
fun foo(x: A<<caret>X>) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
foo(A())
|
||||
foo(A<Int>())
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// "Create type parameter 'X' in function 'foo'" "true"
|
||||
class A<T>
|
||||
|
||||
fun <X> foo(x: A<X>) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
foo<Any?>(A())
|
||||
foo(A<Int>())
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Create type parameter 'X' in function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: _
|
||||
class A<T : List<T>>
|
||||
|
||||
interface I : List<I>
|
||||
|
||||
fun foo(x: A<<caret>X>) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
foo(A())
|
||||
foo(A<I>())
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Create type parameter 'X' in function 'foo'" "true"
|
||||
// ERROR: Unresolved reference: _
|
||||
class A<T : List<T>>
|
||||
|
||||
interface I : List<I>
|
||||
|
||||
fun <X : List<X>> foo(x: A<X>) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
foo<List<_>>(A())
|
||||
foo(A<I>())
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// "Create type parameter 'X' in function 'foo'" "true"
|
||||
class A<T : List<Int>>
|
||||
|
||||
fun foo(x: A<<caret>X>) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
foo(A())
|
||||
foo(A<List<Int>>())
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create type parameter 'X' in function 'foo'" "true"
|
||||
class A<T : List<Int>>
|
||||
|
||||
fun <X : List<Int>> foo(x: A<X>) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
foo<List<Int>>(A())
|
||||
foo(A<List<Int>>())
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Create type parameter 'X'" "false"
|
||||
// ACTION: Create annotation 'X'
|
||||
// ACTION: Create class 'X'
|
||||
// ACTION: Create enum 'X'
|
||||
// ACTION: Create interface 'X'
|
||||
// ACTION: Create type alias 'X'
|
||||
// ERROR: Unresolved reference: X
|
||||
|
||||
class A
|
||||
|
||||
fun foo(x: A.<caret>X) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Create type parameter 'X'" "false"
|
||||
// ACTION: Create class 'X'
|
||||
// ACTION: Create enum 'X'
|
||||
// ACTION: Create interface 'X'
|
||||
// ACTION: Create object 'X'
|
||||
// ERROR: Unresolved reference: X
|
||||
|
||||
class A
|
||||
|
||||
fun foo(x: <caret>X.Y) {
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create type parameter 'X'" "false"
|
||||
// ACTION: Create class 'X'
|
||||
// ACTION: Create interface 'X'
|
||||
// ACTION: Create type alias 'X'
|
||||
// ERROR: Unresolved reference: X
|
||||
|
||||
class A
|
||||
|
||||
fun foo(x: <caret>X<Int>) {
|
||||
|
||||
}
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
// ACTION: Create interface 'NoSuchType'
|
||||
// ACTION: Create type alias 'NoSuchType'
|
||||
// ACTION: Remove explicit lambda parameter types (may break code)
|
||||
// ACTION: Create type parameter 'NoSuchType' in function 'foo'
|
||||
// ERROR: Type mismatch: inferred type is ([ERROR : NoSuchType]) -> Int but Int was expected
|
||||
// ERROR: Unresolved reference: NoSuchType
|
||||
|
||||
|
||||
Reference in New Issue
Block a user