PsiSubstitutor (Set<InferenceVariable> varsToResolve, PsiSubstitutor siteSubstitutor) { PsiSubstitutor substitutor = siteSubstitutor; final Iterator<List<InferenceVariable>> varsIterator = InferenceVariablesOrder.resolveOrderIterator(varsToResolve, this); while (varsIterator.hasNext()) { List<InferenceVariable> vars = varsIterator.next(); final PsiSubstitutor resolveSubset = resolveSubset(vars, substitutor); substitutor = substitutor.putAll(resolveSubset); } return substitutor; }