mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
new inference: choose proper type from equality bounds if present
This commit is contained in:
+1
-1
@@ -419,8 +419,8 @@ public class InferenceSession {
|
||||
PsiType bound = null;
|
||||
for (PsiType eqBound : eqBounds) {
|
||||
if (eqBound == null) continue;
|
||||
if (bound != null && !isProperType(eqBound)) continue;
|
||||
bound = acceptBoundsWithRecursiveDependencies(typeParameter, eqBound, substitutor);
|
||||
if (bound != null) break;
|
||||
}
|
||||
if (bound != null) {
|
||||
if (bound instanceof PsiCapturedWildcardType && eqBounds.size() > 1) {
|
||||
|
||||
+5
-4
@@ -148,13 +148,14 @@ public class SubtypingConstraint implements ConstraintFormula {
|
||||
if (myS instanceof PsiWildcardType) {
|
||||
return inferenceVariable != null && inferenceVariable.isCaptured();
|
||||
} else {
|
||||
if (inferenceVariable != null) {
|
||||
inferenceVariable.addBound(myS, InferenceBound.EQ);
|
||||
final InferenceVariable inferenceVariableS = session.getInferenceVariable(myS);
|
||||
if (inferenceVariableS != null) {
|
||||
inferenceVariableS.addBound(myT, InferenceBound.EQ);
|
||||
return true;
|
||||
}
|
||||
inferenceVariable = session.getInferenceVariable(myS);
|
||||
|
||||
if (inferenceVariable != null) {
|
||||
inferenceVariable.addBound(myT, InferenceBound.EQ);
|
||||
inferenceVariable.addBound(myS, InferenceBound.EQ);
|
||||
return true;
|
||||
}
|
||||
constraints.add(new SubtypingConstraint(myT, myS, true));
|
||||
|
||||
Reference in New Issue
Block a user