fixed PY-11495 Create function: do not propose quick-fix for unresolved parts of fqn

This commit is contained in:
Ekaterina Tuzova
2014-01-24 12:41:36 +04:00
parent 21e2c1debc
commit acf175234f
3 changed files with 11 additions and 1 deletions
@@ -476,7 +476,8 @@ public class PyUnresolvedReferencesInspection extends PyInspection {
}
addAddSelfFix(node, refex, actions);
PyCallExpression callExpression = PsiTreeUtil.getParentOfType(element, PyCallExpression.class);
if (callExpression != null) {
if (callExpression != null && (!(callExpression.getCallee() instanceof PyQualifiedExpression) ||
((PyQualifiedExpression)callExpression.getCallee()).getQualifier() == null)) {
actions.add(new UnresolvedRefCreateFunctionQuickFix(callExpression, refex));
}
PyFunction parentFunction = PsiTreeUtil.getParentOfType(element, PyFunction.class);
@@ -0,0 +1 @@
<error descr="Unresolved reference 'my_ref'">my_<caret>ref</error>.do_smth(1, 2)
@@ -266,6 +266,14 @@ public class PyQuickFixTest extends PyTestCase {
PyBundle.message("QFIX.unresolved.reference.create.function.$0", "ref"), true, true);
}
public void testUnresolvedRefNoCreateFunction() {
myFixture.enableInspections(PyUnresolvedReferencesInspection.class);
myFixture.configureByFile("UnresolvedRefNoCreateFunction.py");
myFixture.checkHighlighting(true, false, false);
final IntentionAction intentionAction = myFixture.getAvailableIntention(PyBundle.message("QFIX.unresolved.reference.create.function.$0", "ref"));
assertNull(intentionAction);
}
public void testReplaceNotEqOperator() {
doInspectionTest("ReplaceNotEqOperator.py", PyCompatibilityInspection.class,
PyBundle.message("INTN.replace.noteq.operator"), true, true);