KotlinFunctionCallUsage: fix psi tree
#KT-38632
This commit is contained in:
+7
-3
@@ -305,11 +305,13 @@ class KotlinFunctionCallUsage(
|
||||
defaultValueForCall != null -> substituteReferences(defaultValueForCall, parameter.defaultValueParameterReferences, psiFactory)
|
||||
else -> null
|
||||
}
|
||||
|
||||
val argName = (if (isInsideOfCallerBody) null else name)?.let { Name.identifier(it) }
|
||||
return psiFactory.createArgument(argValue ?: psiFactory.createExpression("0"), argName).apply {
|
||||
generatedArgumentValue = true
|
||||
if (argValue == null) {
|
||||
getArgumentExpression()!!.delete()
|
||||
getArgumentExpression()?.delete()
|
||||
} else {
|
||||
generatedArgumentValue = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -437,7 +439,9 @@ class KotlinFunctionCallUsage(
|
||||
}
|
||||
|
||||
val oldArgumentList = element.valueArgumentList.sure { "Argument list is expected: " + element.text }
|
||||
replaceListPsiAndKeepDelimiters(oldArgumentList, newArgumentList) { arguments }
|
||||
for (argument in replaceListPsiAndKeepDelimiters(oldArgumentList, newArgumentList) { arguments }.arguments) {
|
||||
if (argument.getArgumentExpression() == null) argument.delete()
|
||||
}
|
||||
|
||||
element.accept(
|
||||
object : KtTreeVisitorVoid() {
|
||||
|
||||
Vendored
+1
-1
@@ -4,5 +4,5 @@
|
||||
class A<T>(val n: T, val foo: A<Int>)
|
||||
|
||||
fun test() {
|
||||
val a: A<Int> = A(1, ).foo
|
||||
val a: A<Int> = A(1,).foo
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -4,5 +4,5 @@
|
||||
class A<T>(val n: T, var foo: String)
|
||||
|
||||
fun test() {
|
||||
A(1, ).foo = "1"
|
||||
A(1,).foo = "1"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user