Fix ArrayIndexOutOfBoundsException in named parameters completion
This commit is contained in:
@@ -221,11 +221,13 @@ public class QuickFixUtil {
|
||||
isPositionalArgument = false;
|
||||
}
|
||||
else if (isPositionalArgument) {
|
||||
ValueParameterDescriptor parameter = callableDescriptor.getValueParameters().get(idx);
|
||||
if (argument != ignoreArgument) {
|
||||
usedParameters.add(parameter.getName().asString());
|
||||
if (callableDescriptor.getValueParameters().size() > idx) {
|
||||
ValueParameterDescriptor parameter = callableDescriptor.getValueParameters().get(idx);
|
||||
if (argument != ignoreArgument) {
|
||||
usedParameters.add(parameter.getName().asString());
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
fun test() {}
|
||||
fun some() {
|
||||
val localVal = 1
|
||||
test(<caret>)
|
||||
}
|
||||
|
||||
// Test no exceptions are thrown
|
||||
// INVOCATION_COUNT: 1
|
||||
// EXIST: localVal
|
||||
@@ -498,6 +498,11 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest("idea/testData/completion/basic/common/namedParameters/CompactTypeNames.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ForEmptyParametersFunction.kt")
|
||||
public void testForEmptyParametersFunction() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/namedParameters/ForEmptyParametersFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InParameterExpression.kt")
|
||||
public void testInParameterExpression() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/namedParameters/InParameterExpression.kt");
|
||||
|
||||
@@ -498,6 +498,11 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest("idea/testData/completion/basic/common/namedParameters/CompactTypeNames.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ForEmptyParametersFunction.kt")
|
||||
public void testForEmptyParametersFunction() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/namedParameters/ForEmptyParametersFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InParameterExpression.kt")
|
||||
public void testInParameterExpression() throws Exception {
|
||||
doTest("idea/testData/completion/basic/common/namedParameters/InParameterExpression.kt");
|
||||
|
||||
Reference in New Issue
Block a user