mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-13114 Inlining of method call does not add extra parenthesis
Fix prioritization problem: reference expressions should have the same priority as indexing, slicing and function calls.
This commit is contained in:
@@ -441,7 +441,10 @@ public class PyReplaceExpressionUtil implements PyElementTypes {
|
||||
|
||||
private static int getExpressionPriority(PyElement expr) {
|
||||
int priority = 0;
|
||||
if (expr instanceof PySubscriptionExpression || expr instanceof PySliceExpression || expr instanceof PyCallExpression) priority = 1;
|
||||
if (expr instanceof PyReferenceExpression ||
|
||||
expr instanceof PySubscriptionExpression ||
|
||||
expr instanceof PySliceExpression ||
|
||||
expr instanceof PyCallExpression) priority = 1;
|
||||
else if (expr instanceof PyPrefixExpression) {
|
||||
final IElementType opType = getOperationType(expr);
|
||||
if (opType == PLUS || opType == MINUS || opType == TILDE) priority = 2;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
a.method().strip()
|
||||
@@ -0,0 +1,2 @@
|
||||
res = a.method()
|
||||
res.strip()
|
||||
@@ -104,6 +104,11 @@ public class PyInlineLocalTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-13114
|
||||
public void testMethodCallInlinedAsQualifier() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-12409
|
||||
public void testResultExceedsRightMargin() {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(myFixture.getProject());
|
||||
|
||||
Reference in New Issue
Block a user