revert new inference: mark erased for type params/raw types compatibility (IDEA-126379)

This commit is contained in:
Anna Kozlova
2014-06-19 17:07:38 +02:00
parent 018818f7f4
commit 2171c25296
4 changed files with 27 additions and 3 deletions

View File

@@ -75,8 +75,6 @@ public class TypeCompatibilityConstraint implements ConstraintFormula {
if (sSubstitutor != null && PsiUtil.isRawSubstitutor(tClass, sSubstitutor)) {
return true;
}
//comment in 18.2.2. Type Compatibility Constraints
if (tClass instanceof PsiTypeParameter && ((PsiClassType)s).isRaw()) return true;
}
}
else if (t instanceof PsiArrayType && t.getArrayDimensions() == s.getArrayDimensions()) {

View File

@@ -7,7 +7,11 @@ class Foo<T> {
List<Foo> elements = getElements(parent);
for (<error descr="Incompatible types. Found: 'java.lang.Object', required: 'Foo'">Foo foo : getElements(parent)</error>) {
/*for (Foo foo : getElements(parent)) {
System.out.println(foo);
}*/
for (Foo foo : getElementsArray(parent)) {
System.out.println(foo);
}
}
@@ -15,4 +19,8 @@ class Foo<T> {
public static <E extends Foo<E>> List<E> getElements(E parent) {
return new ArrayList<>();
}
public static <E extends Foo<E>> E[] getElementsArray(E parent) {
return null;
}
}

View File

@@ -0,0 +1,14 @@
import java.util.*;
class Test {
protected Class[] getAllInterfaces(final Set<Class> interfaces, final Class[] classes) {
return interfaces.toArray(classes);
}
public static <T extends Collection<String>> T get(T out) {
return out;
}
public static void main(String[] args) {
Set<String> set = get(new HashSet());
}
}

View File

@@ -184,6 +184,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
doTest();
}
public void testRawTypeFromParentArrayType() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(false);
}