mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-101461 Groovy - good code red
This commit is contained in:
@@ -50,6 +50,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpres
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrCallExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrIndexProperty;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrAnonymousClassDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrGdkMethod;
|
||||
@@ -603,7 +604,7 @@ public class ResolveUtil {
|
||||
}
|
||||
|
||||
public static boolean isKeyOfMap(GrReferenceExpression ref) {
|
||||
if (isCall(ref)) return false;
|
||||
if (!(ref.getParent() instanceof GrIndexProperty) && isCall(ref)) return false;
|
||||
if (ref.multiResolve(false).length > 0) return false;
|
||||
return mayBeKeyOfMap(ref);
|
||||
}
|
||||
|
||||
+13
@@ -1085,4 +1085,17 @@ def book = new Book(title: "Other Title", author: [name: "Other Name"])
|
||||
assert book.toString() == 'Other Title by Other Name'
|
||||
''')
|
||||
}
|
||||
|
||||
void testArrayAccessForMapProperty() {
|
||||
|
||||
testHighlighting('''\
|
||||
def bar() {
|
||||
return [list:[1, 2, 3]]
|
||||
}
|
||||
|
||||
def testConfig = bar()
|
||||
print testConfig.list[0]
|
||||
print testConfig.<warning descr="Cannot resolve symbol 'foo'">foo</warning>()
|
||||
''', true, false, false, GrUnresolvedAccessInspection)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user