From 465762a96e2bc2c1b7c91bd86ef04e30a1f85d9f Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 7 Nov 2013 19:01:26 +0100 Subject: [PATCH] new inference: reject multiple eq bounds --- .../graphInference/InferenceSession.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java index 7f1accc7b802..988cd9755cca 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java @@ -427,16 +427,17 @@ public class InferenceSession { inferenceVariable.setInstantiation(null); continue; } - 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) { - if (bound instanceof PsiCapturedWildcardType && eqBounds.size() > 1) { - continue; + if (eqBounds.size() > 1) { + for (Iterator iterator = eqBounds.iterator(); iterator.hasNext(); ) { + PsiType eqBound = iterator.next(); + if (PsiUtil.resolveClassInType(eqBound) == typeParameter) { + iterator.remove(); + } } + if (eqBounds.size() > 1) continue; + } + PsiType bound = eqBounds.isEmpty() ? null : acceptBoundsWithRecursiveDependencies(typeParameter, eqBounds.get(0), substitutor); + if (bound != null) { inferenceVariable.setInstantiation(bound); } else { PsiType lub = null;