add type cast intention for poly expressions (IDEA-188731)

inference errors on poly expressions are not propagated to the expected type (variable declaration, return statement, etc) like for standalone expressions: dedicated intentions should be registered
This commit is contained in:
Anna.Kozlova
2018-03-23 15:06:39 +01:00
parent 6a3e6deead
commit 232b29888a
4 changed files with 47 additions and 0 deletions
@@ -0,0 +1,13 @@
// "Cast to 'B'" "true"
import java.util.*;
class A { }
class B extends A {
public B getStrings() {
return (B) getFirstItem(new ArrayList<A>());
}
public static <T> T getFirstItem(Set<T> items) { return null; }
public static <T> T getFirstItem(List<T> items) { return null; }
}
@@ -0,0 +1,13 @@
// "Cast to 'B'" "true"
import java.util.*;
class A { }
class B extends A {
public B getStrings() {
return get<caret>FirstItem(new ArrayList<A>());
}
public static <T> T getFirstItem(Set<T> items) { return null; }
public static <T> T getFirstItem(List<T> items) { return null; }
}
@@ -0,0 +1,13 @@
// "Cast to 'B'" "false"
import java.util.*;
class A { }
class B extends A {
public B getStrings() {
return get<caret>FirstItem(new ArrayList<A>());
}
public static <T> T getFirstItem(Set<T> items) { return null; }
public static <T> ArrayList<T> getFirstItem(List<T> items) { return null; }
}