mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
incorporation: deal with PsiType.NULL (IDEA-147529)
This commit is contained in:
+2
-2
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
+4
@@ -323,6 +323,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIncorporationWithRawSubstitutors() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user