Files
Anna Kozlova ce97fcef18 [kotlin] k2: implement Deprecated replacement fix
- works for callables only
- replace in the whole project is not yet implemented
- disabled tests:
 -- tests on classes/objects placed in wrong directories
 -- tests on replace in the whole project
 -- optimized imports
 -- reported problems with inline refactoring
 -- 3 tests with broken type arguments while inline itself works ok

KTIJ-29498

GitOrigin-RevId: 046264742291bd6b1525d8df16535a14351879ee
2024-06-14 21:43:23 +00:00

24 lines
623 B
Plaintext

// "Replace with 'c1.newFun(this, c2)'" "true"
// WITH_STDLIB
class X {
@Deprecated("", ReplaceWith("c1.newFun(this, c2)"))
fun oldFun(c1: Char, c2: Char): Char = c1.newFun(this, c2)
val c: Char = 'a'
}
fun Char.newFun(x: X, c: Char): Char = this
fun foo(s: String, x: X) {
val chars = s.filter {
O.x?.<caret>let { x1 -> it.newFun(x1, x.c) } != 'a'
}
}
object O {
var x: X? = null
}
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.replaceWith.DeprecatedSymbolUsageFix
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.replaceWith.DeprecatedSymbolUsageFix