incorporation: deal with PsiType.NULL (IDEA-147529)

This commit is contained in:
Anna Kozlova
2015-11-10 18:45:36 +01:00
parent c29f92472e
commit 99338ada50
3 changed files with 32 additions and 2 deletions
@@ -265,9 +265,9 @@ public class InferenceIncorporationPhase {
*/
private void upDown(List<PsiType> eqBounds, List<PsiType> upperBounds, PsiSubstitutor substitutor) {
for (PsiType upperBound : upperBounds) {
if (upperBound == null) continue;
if (upperBound == null || PsiType.NULL.equals(upperBound)) continue;
for (PsiType eqBound : eqBounds) {
if (eqBound == null) continue;
if (eqBound == null || PsiType.NULL.equals(eqBound)) continue;
addConstraint(new StrictSubtypingConstraint(substitutor.substitute(upperBound), substitutor.substitute(eqBound)));
}
}
@@ -0,0 +1,26 @@
import java.io.Serializable;
import java.util.function.BiFunction;
class Test {
interface HasCode<T extends Serializable> {
static <U extends Serializable, T extends Enum<T> & HasCode<U>> T fromCode(U code, Class<T> classEnum) {
return null;
}
}
enum EnumRaw implements HasCode{
RAW_VALUE1;
}
public static <T, U extends Serializable, R> R checkExpected(BiFunction<T, U, R> funct, T param, U secondParam, R expectedResult){
R result = funct.apply(param, secondParam);
return result;
}
public static void main(String[] args){
checkExpected(HasCode::fromCode, "RAW_VALUE2", EnumRaw.class, EnumRaw.RAW_VALUE1);
}
}
@@ -323,6 +323,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
doTest();
}
public void testIncorporationWithRawSubstitutors() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(false);
}