mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inference: don't check bounds for variables which may depend on another variable with inconsistency bounds
This commit is contained in:
+4
-1
@@ -602,6 +602,7 @@ public class InferenceSession {
|
||||
}
|
||||
|
||||
PsiSubstitutor prepareSubstitution() {
|
||||
boolean foundErrorMessage = false;
|
||||
Iterator<List<InferenceVariable>> iterator = InferenceVariablesOrder.resolveOrderIterator(myInferenceVariables, this);
|
||||
while (iterator.hasNext()) {
|
||||
final List<InferenceVariable> variables = iterator.next();
|
||||
@@ -610,7 +611,9 @@ public class InferenceSession {
|
||||
PsiType instantiation = inferenceVariable.getInstantiation();
|
||||
//failed inference
|
||||
if (instantiation == PsiType.NULL) {
|
||||
checkBoundsConsistency(mySiteSubstitutor, inferenceVariable);
|
||||
if (!foundErrorMessage) {
|
||||
foundErrorMessage = checkBoundsConsistency(mySiteSubstitutor, inferenceVariable) == PsiType.NULL;
|
||||
}
|
||||
mySiteSubstitutor = mySiteSubstitutor
|
||||
.put(typeParameter, JavaPsiFacade.getInstance(typeParameter.getProject()).getElementFactory().createType(typeParameter));
|
||||
}
|
||||
|
||||
+1
-4
@@ -12,10 +12,7 @@ class Test {
|
||||
SuperFoo<String> ls = foo(<error descr="no instance(s) of type variable(s) exist so that String conforms to Number
|
||||
inference variable R has incompatible bounds:
|
||||
equality constraints: String
|
||||
upper bounds: Object, Number
|
||||
inference variable X has incompatible bounds:
|
||||
equality constraints: R
|
||||
upper bounds: Number">() -> new Foo<>()</error>);
|
||||
upper bounds: Object, Number">() -> new Foo<>()</error>);
|
||||
SuperFoo<Integer> li = foo(() -> new Foo<>());
|
||||
SuperFoo<?> lw = foo(() -> new Foo<>());
|
||||
}
|
||||
+1
-4
@@ -29,10 +29,7 @@ abstract class NoFormalParamTypeInferenceNeeded {
|
||||
Integer zip = zip(a -> zip(<error descr="no instance(s) of type variable(s) exist so that Object conforms to Integer
|
||||
inference variable R has incompatible bounds:
|
||||
lower bounds: Object
|
||||
upper bounds: Object, Integer
|
||||
inference variable R has incompatible bounds:
|
||||
lower bounds: Object
|
||||
upper bounds: Object, R, Integer">text -> text</error>));
|
||||
upper bounds: Object, Integer">text -> text</error>));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user