File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -1111,18 +1111,18 @@ bool BindingSet::favoredOverConjunction(Constraint *conjunction) const {
11111111 }))
11121112 return true ;
11131113
1114- // If conjunction references a single type variable (closure itself)
1115- // it means that the builder is either not generic or has all of its
1116- // generic parameter specified explicitly, and there are no references
1117- // to declarations from outer context. Such conjunctions don't have to
1118- // be delayed.
1119- if (conjunction-> getTypeVariables (). size () == 1 ) {
1120- assert (
1121- conjunction-> getTypeVariables ()[ 0 ]-> isEqual ( CS.getType (closure)) );
1122- return false ;
1123- }
1124-
1125- return true ;
1114+ // Check whether conjunction has any unresolved type variables
1115+ // besides the variable that represents the closure.
1116+ //
1117+ // Conjunction could refer to declarations from outer context
1118+ // (i.e. a variable declared in the outer closure) or generic
1119+ // parameters of the builder type), if any of such references
1120+ // are not yet inferred the conjunction has to be delayed.
1121+ auto *closureType = CS.getType (closure)-> castTo <TypeVariableType>( );
1122+ return llvm::any_of (
1123+ conjunction-> getTypeVariables (), [&](TypeVariableType *typeVar) {
1124+ return !(typeVar == closureType || CS. getFixedType (typeVar));
1125+ }) ;
11261126 }
11271127 }
11281128
You can’t perform that action at this time.
0 commit comments