mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-66809 Inline method changes map key semantics
This commit is contained in:
@@ -43,6 +43,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrStatement;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariableDeclaration;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentLabel;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrCodeBlock;
|
||||
@@ -83,7 +84,9 @@ public class PsiImplUtil {
|
||||
}
|
||||
|
||||
// Remove unnecessary parentheses
|
||||
if (removeUnnecessaryParentheses && oldParent instanceof GrParenthesizedExpression) {
|
||||
if (removeUnnecessaryParentheses &&
|
||||
oldParent instanceof GrParenthesizedExpression &&
|
||||
!(oldParent.getParent() instanceof GrArgumentLabel)) {
|
||||
return ((GrExpression)oldParent).replaceWithExpression(newExpr, removeUnnecessaryParentheses);
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -96,6 +96,7 @@ public class InlineMethodTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testFieldAsParameter() throws Throwable { doTest(); }
|
||||
public void testWritableVariable() throws Throwable { doTest(); }
|
||||
public void testSingleExpression() {doTest();}
|
||||
public void testNamedArg() {doTest();}
|
||||
public void _testInlineInGString() throws Throwable {doTest(); }
|
||||
|
||||
public void testInlineAll() throws Throwable {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
def foo(name) {
|
||||
[(name):2]
|
||||
}
|
||||
|
||||
def bar = 3+4
|
||||
def x = <selection>foo</selection>(bar)
|
||||
-----
|
||||
def foo(name) {
|
||||
[(name):2]
|
||||
}
|
||||
|
||||
def bar = 3+4
|
||||
def x = [(bar):2]
|
||||
Reference in New Issue
Block a user