mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-11561 "Add super class call" incorrectly inserts parameter annotations
This commit is contained in:
@@ -149,15 +149,15 @@ public class AddCallSuperQuickFix implements LocalQuickFix {
|
||||
for (int i = 1; i != parameters.length; i++) {
|
||||
PyParameter p = parameters[i];
|
||||
if (p.getDefaultValue() != null) continue;
|
||||
String param;
|
||||
param = p.getText();
|
||||
if (param.startsWith("**")) {
|
||||
final String param = p.getName();
|
||||
String paramText = p.getText();
|
||||
if (paramText.startsWith("**")) {
|
||||
addDouble = true;
|
||||
if (doubleStarName == null)
|
||||
doubleStarName = p.getText();
|
||||
continue;
|
||||
}
|
||||
if (param.startsWith("*")) {
|
||||
if (paramText.startsWith("*")) {
|
||||
addStar = true;
|
||||
if (starName == null)
|
||||
starName = p.getText();
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class Example1:
|
||||
def __init__(self, field1: str):
|
||||
self.field1 = field1
|
||||
|
||||
|
||||
class Example2(Example1):
|
||||
def <warning descr="Call to __init__ of super class is missed">__i<caret>nit__</warning>(self): ## Missed call to __init__ of super class
|
||||
pass
|
||||
@@ -0,0 +1,8 @@
|
||||
class Example1:
|
||||
def __init__(self, field1: str):
|
||||
self.field1 = field1
|
||||
|
||||
|
||||
class Example2(Example1):
|
||||
def __init__(self, field1):
|
||||
super().__init__(field1)
|
||||
@@ -270,7 +270,8 @@ public class PyQuickFixTest extends PyTestCase {
|
||||
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"));
|
||||
final IntentionAction intentionAction = myFixture.getAvailableIntention(
|
||||
PyBundle.message("QFIX.unresolved.reference.create.function.$0", "ref"));
|
||||
assertNull(intentionAction);
|
||||
}
|
||||
|
||||
@@ -314,6 +315,17 @@ public class PyQuickFixTest extends PyTestCase {
|
||||
PyBundle.message("QFIX.add.super"), true, true);
|
||||
}
|
||||
|
||||
public void testAddCallSuperAnnotations() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON33, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doInspectionTest("AddCallSuperAnnotations.py",
|
||||
PyMissingConstructorInspection.class,
|
||||
PyBundle.message("QFIX.add.super"), true, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testAddCallSuperPass() { //PY-8654
|
||||
doInspectionTest("AddCallSuperPass.py", PyMissingConstructorInspection.class,
|
||||
PyBundle.message("QFIX.add.super"), true, true);
|
||||
|
||||
Reference in New Issue
Block a user