diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/AddNameToArgumentFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/AddNameToArgumentFix.java index ea4fb5d2021..b0c986888f6 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/AddNameToArgumentFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/AddNameToArgumentFix.java @@ -63,9 +63,6 @@ public class AddNameToArgumentFix extends JetIntentionAction { JetCallElement callElement = PsiTreeUtil.getParentOfType(argument, JetCallElement.class); assert callElement != null : "The argument has to be inside a function or constructor call"; - JetExpression callee = callElement.getCalleeExpression(); - if (!(callee instanceof JetReferenceExpression)) return Collections.emptyList(); - BindingContext context = ResolvePackage.getBindingContext(argument.getContainingJetFile()); ResolvedCall resolvedCall = BindingContextUtilPackage.getResolvedCall(callElement, context); if (resolvedCall == null) return Collections.emptyList(); diff --git a/idea/testData/quickfix/checkArguments/afterInvokeOnString.kt b/idea/testData/quickfix/checkArguments/afterInvokeOnString.kt new file mode 100644 index 00000000000..13522e67947 --- /dev/null +++ b/idea/testData/quickfix/checkArguments/afterInvokeOnString.kt @@ -0,0 +1,6 @@ +// "Add name to argument: 'b = 42'" "true" +fun String.invoke(a: Int, b: Int) {} + +fun g() { + ""(a = 1, b = 42) +} diff --git a/idea/testData/quickfix/checkArguments/beforeInvokeOnString.kt b/idea/testData/quickfix/checkArguments/beforeInvokeOnString.kt new file mode 100644 index 00000000000..73b6d2c21aa --- /dev/null +++ b/idea/testData/quickfix/checkArguments/beforeInvokeOnString.kt @@ -0,0 +1,6 @@ +// "Add name to argument: 'b = 42'" "true" +fun String.invoke(a: Int, b: Int) {} + +fun g() { + ""(a = 1, 42) +} diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java index 24f67be603a..fb29e080e60 100644 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java @@ -477,6 +477,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/quickfix/checkArguments"), Pattern.compile("^before(\\w+)\\.kt$"), true); } + @TestMetadata("beforeInvokeOnString.kt") + public void testInvokeOnString() throws Exception { + doTest("idea/testData/quickfix/checkArguments/beforeInvokeOnString.kt"); + } + @TestMetadata("beforeMixedNamedAndPositionalArguments.kt") public void testMixedNamedAndPositionalArguments() throws Exception { doTest("idea/testData/quickfix/checkArguments/beforeMixedNamedAndPositionalArguments.kt");