Inliner: don't take into account nonexistent PSI to keep parameter
So #KT-17272 Fixed
This commit is contained in:
@@ -305,6 +305,7 @@ class CodeInliner<TCallElement : KtElement>(
|
||||
is KtBinaryExpression -> if (sideEffectOnly) left.shouldKeepValue(usageCount) || right.shouldKeepValue(usageCount) else true
|
||||
is KtIfExpression -> if (sideEffectOnly) condition.shouldKeepValue(usageCount) || then.shouldKeepValue(usageCount) || `else`.shouldKeepValue(usageCount) else true
|
||||
is KtBinaryExpressionWithTypeRHS -> true
|
||||
null -> false
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
fun manyParams(used: String, unused: String) = println(used)
|
||||
|
||||
fun callMany() {
|
||||
<caret>manyParams("op", "qr")
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun callMany() {
|
||||
println("op")
|
||||
}
|
||||
@@ -118,6 +118,12 @@ public class InlineTestGenerated extends AbstractInlineTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("DoNotKeepString.kt")
|
||||
public void testDoNotKeepString() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/inline/function/expressionBody/DoNotKeepString.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExplicitReturnType.kt")
|
||||
public void testExplicitReturnType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/inline/function/expressionBody/ExplicitReturnType.kt");
|
||||
|
||||
Reference in New Issue
Block a user