IDEA-106091 Groovy: index access resolving in case of unresolved invoked expression

This commit is contained in:
Max Medvedev
2013-04-24 20:58:48 +04:00
parent 553e354981
commit c7a5dd9fa2
3 changed files with 10 additions and 5 deletions
@@ -72,7 +72,10 @@ public class GrIndexPropertyImpl extends GrExpressionImpl implements GrIndexProp
GrExpression selected = getInvokedExpression();
PsiType thisType = selected.getType();
if (thisType == null) return null;
if (thisType == null) {
thisType = TypesUtil.getJavaLangObject(this);
}
GrArgumentList argList = getArgumentList();
@@ -153,7 +156,9 @@ public class GrIndexPropertyImpl extends GrExpressionImpl implements GrIndexProp
GrExpression invoked = getInvokedExpression();
PsiType thisType = invoked.getType();
if (thisType == null) return GroovyResolveResult.EMPTY_ARRAY;
if (thisType == null) {
thisType = TypesUtil.getJavaLangObject(this);
}
GrArgumentList argList = getArgumentList();
@@ -570,7 +570,7 @@ print i<warning descr="'getAt' in 'X' cannot be applied to '(java.lang.String, j
void testArrayAccess5() {
testHighlighting('''\
print a<warning descr="Cannot resolve index access with arguments (java.lang.Integer)">[1]</warning>
print a<warning descr="'getAt' in 'org.codehaus.groovy.runtime.DefaultGroovyMethods' cannot be applied to '(java.lang.Integer, java.lang.Integer)'">[1, 2]</warning>
''')
}
@@ -632,7 +632,7 @@ i<warning descr="'putAt' in 'X' cannot be applied to '(java.lang.String, java.la
void testArrayAccess10() {
testHighlighting('''\
a<warning descr="Cannot resolve index access with arguments (java.lang.Integer, java.lang.Integer)">[1]</warning> = 2
a<warning descr="'putAt' in 'org.codehaus.groovy.runtime.DefaultGroovyMethods' cannot be applied to '(java.lang.Integer, java.lang.Integer, java.lang.Integer)'">[1, 3]</warning> = 2
''')
}
@@ -1,2 +1,2 @@
java.lang.Object foo;
print(foo.getAt(1));
print(org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(foo, 1));