IDEA-51929: Passing empty list to super Groovy constructor gives wrong incompatibility warning

This commit is contained in:
Maxim Medvedev
2010-01-31 17:57:47 +03:00
parent eaf3e66905
commit f092ea4fad
3 changed files with 24 additions and 0 deletions
@@ -219,6 +219,17 @@ public class TypesUtil {
public static boolean isAssignableByMethodCallConversion(PsiType lType, PsiType rType, PsiManager manager, GlobalSearchScope scope) {
if (lType == null || rType == null) return false;
if (rType instanceof GrTupleType) {
final GrTupleType tuple = (GrTupleType)rType;
if (tuple.getComponentTypes().length == 0) {
if (lType instanceof PsiArrayType ||
InheritanceUtil.isInheritor(lType, JAVA_UTIL_LIST) ||
InheritanceUtil.isInheritor(lType, JAVA_UTIL_SET)) {
return true;
}
}
}
if (rType.equalsToText(GrStringUtil.GROOVY_LANG_GSTRING)) {
final PsiClass javaLangString = JavaPsiFacade.getInstance(manager.getProject()).findClass(JAVA_LANG_STRING, scope);
if (javaLangString != null &&
@@ -207,4 +207,6 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
public void testArrayLikeAccess() throws Exception {doTest();}
public void testSetInitializing() throws Exception {doTest();}
public void testEmptyTupleAssignability() throws Exception {doTest();}
}
@@ -0,0 +1,11 @@
class Foo {
Foo(List<String> l) {
}
}
class Bar extends Foo {
def Bar() {
super([])
}
}