Improve "ReplaceWith" for class with generic parameter
#KT-27089 Fixed
This commit is contained in:
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'NewClass<T>'" "true"
|
||||
// "Replace with 'NewClass<Int>'" "true"
|
||||
package ppp
|
||||
|
||||
@Deprecated("renamed", ReplaceWith("NewClass<T>"))
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'NewClass<T>'" "true"
|
||||
// "Replace with 'NewClass<Int>'" "true"
|
||||
package ppp
|
||||
|
||||
@Deprecated("renamed", ReplaceWith("NewClass<T>"))
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with 'Factory<Int>()'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo<T> @Deprecated("", ReplaceWith("Factory<T>()")) constructor()
|
||||
fun <T> Factory(): Foo<T> = TODO()
|
||||
|
||||
fun baz() {
|
||||
val foo = <caret>Foo<Int>()
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with 'Factory<Int>()'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo<T> @Deprecated("", ReplaceWith("Factory<T>()")) constructor()
|
||||
fun <T> Factory(): Foo<T> = TODO()
|
||||
|
||||
fun baz() {
|
||||
val foo = <caret>Factory<Int>()
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with 'Factory<Int>()'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo<T> @Deprecated("", ReplaceWith("Factory()")) constructor()
|
||||
fun <T> Factory(): Foo<T> = TODO()
|
||||
|
||||
fun baz() {
|
||||
val foo = <caret>Foo<Int>()
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with 'Factory<Int>()'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo<T> @Deprecated("", ReplaceWith("Factory()")) constructor()
|
||||
fun <T> Factory(): Foo<T> = TODO()
|
||||
|
||||
fun baz() {
|
||||
val foo = <caret>Factory<Int>()
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with 'test.New'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
package test
|
||||
|
||||
abstract class Main<T>
|
||||
|
||||
@Deprecated("", ReplaceWith("test.New"))
|
||||
class Old<T> : Main<T>()
|
||||
|
||||
class New<T> : Main<T>()
|
||||
|
||||
fun test() {
|
||||
val main = <caret>Old<Int>()
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with 'test.New'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
package test
|
||||
|
||||
abstract class Main<T>
|
||||
|
||||
@Deprecated("", ReplaceWith("test.New"))
|
||||
class Old<T> : Main<T>()
|
||||
|
||||
class New<T> : Main<T>()
|
||||
|
||||
fun test() {
|
||||
val main = <caret>New<Int>()
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with 'New'" "true"
|
||||
// WITH_RUNTIME
|
||||
// ERROR: Type inference failed: Not enough information to infer parameter T in constructor New<T>()<br>Please specify it explicitly.<br>
|
||||
|
||||
abstract class Main<T>
|
||||
|
||||
@Deprecated("", ReplaceWith("New"))
|
||||
class Old<T, F> : Main<T>()
|
||||
|
||||
class New<T> : Main<T>()
|
||||
|
||||
fun test() {
|
||||
val main = <caret>Old<Int, String>()
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with 'New'" "true"
|
||||
// WITH_RUNTIME
|
||||
// ERROR: Type inference failed: Not enough information to infer parameter T in constructor New<T>()<br>Please specify it explicitly.<br>
|
||||
|
||||
abstract class Main<T>
|
||||
|
||||
@Deprecated("", ReplaceWith("New"))
|
||||
class Old<T, F> : Main<T>()
|
||||
|
||||
class New<T> : Main<T>()
|
||||
|
||||
fun test() {
|
||||
val main = <caret>New()
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with 'Factory()'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo<T> @Deprecated("", ReplaceWith("Factory<T>()")) constructor()
|
||||
fun <T> Factory(): Foo<T> = TODO()
|
||||
|
||||
fun baz() {
|
||||
val foo: Foo<Int> = <caret>Foo()
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with 'Factory()'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo<T> @Deprecated("", ReplaceWith("Factory<T>()")) constructor()
|
||||
fun <T> Factory(): Foo<T> = TODO()
|
||||
|
||||
fun baz() {
|
||||
val foo: Foo<Int> = <caret>Factory()
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'newFun(*elements)'" "true"
|
||||
// "Replace with 'newFun<String>(*elements)'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun(*elements)"))
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'newFun(*elements)'" "true"
|
||||
// "Replace with 'newFun<String>(*elements)'" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun(*elements)"))
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'newFun<T>()'" "true"
|
||||
// "Replace with 'newFun()'" "true"
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun<T>()"))
|
||||
fun <T : Any> oldFun(): T? {
|
||||
|
||||
idea/testData/quickfix/deprecatedSymbolUsage/typeArguments/explicitInPatternImplicitInUsage.kt.after
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'newFun<T>()'" "true"
|
||||
// "Replace with 'newFun()'" "true"
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun<T>()"))
|
||||
fun <T : Any> oldFun(): T? {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'newFun<T>()'" "true"
|
||||
// "Replace with 'newFun<String>()'" "true"
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun<T>()"))
|
||||
fun <T> oldFun() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'newFun<T>()'" "true"
|
||||
// "Replace with 'newFun<String>()'" "true"
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun<T>()"))
|
||||
fun <T> oldFun() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'newFun<T>()'" "true"
|
||||
// "Replace with 'newFun<kotlin.Int>()'" "true"
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun<T>()"))
|
||||
fun <T> oldFun() {
|
||||
|
||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'newFun<T>()'" "true"
|
||||
// "Replace with 'newFun<kotlin.Int>()'" "true"
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun<T>()"))
|
||||
fun <T> oldFun() {
|
||||
@@ -8,5 +8,5 @@ fun <T> oldFun() {
|
||||
fun <T> newFun(){}
|
||||
|
||||
fun foo() {
|
||||
<caret>newFun<kotlin.Int>()
|
||||
<caret>newFun<Int>()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user