ReplaceWith: don't keep class literal & callable reference in inlining

#KT-30197 Fixed
This commit is contained in:
Mikhail Glukhikh
2019-07-09 18:15:37 +03:00
parent 615aa265f5
commit 5afa5de1d7
4 changed files with 25 additions and 0 deletions
@@ -333,6 +333,8 @@ class CodeInliner<TCallElement : KtElement>(
usageCount usageCount
) else true ) else true
is KtBinaryExpressionWithTypeRHS -> true is KtBinaryExpressionWithTypeRHS -> true
is KtClassLiteralExpression -> false
is KtCallableReferenceExpression -> false
null -> false null -> false
else -> true else -> true
} }
@@ -0,0 +1,9 @@
// "Replace with 'bar(y)'" "true"
@Deprecated("", replaceWith = ReplaceWith("bar(y)"))
fun foo(x: Any, y: Any, z: Any) {
}
fun bar(y: Any) {}
fun main() {
<caret>foo(4::class, 42::dec, ::bar)
}
@@ -0,0 +1,9 @@
// "Replace with 'bar(y)'" "true"
@Deprecated("", replaceWith = ReplaceWith("bar(y)"))
fun foo(x: Any, y: Any, z: Any) {
}
fun bar(y: Any) {}
fun main() {
bar(42::dec)
}
@@ -6065,6 +6065,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
public void testStringTemplateUsedTwice2() throws Exception { public void testStringTemplateUsedTwice2() throws Exception {
runTest("idea/testData/quickfix/deprecatedSymbolUsage/argumentSideEffects/stringTemplateUsedTwice2.kt"); runTest("idea/testData/quickfix/deprecatedSymbolUsage/argumentSideEffects/stringTemplateUsedTwice2.kt");
} }
@TestMetadata("withLiteralAndReference.kt")
public void testWithLiteralAndReference() throws Exception {
runTest("idea/testData/quickfix/deprecatedSymbolUsage/argumentSideEffects/withLiteralAndReference.kt");
}
} }
@TestMetadata("idea/testData/quickfix/deprecatedSymbolUsage/classUsages") @TestMetadata("idea/testData/quickfix/deprecatedSymbolUsage/classUsages")