@@ -1208,19 +1208,7 @@ bool BindingSet::isViable(PotentialBinding &binding, bool isTransitive) {
12081208 if (!existingNTD || NTD != existingNTD)
12091209 continue ;
12101210
1211- // What is going on here needs to be thoroughly re-evaluated,
1212- // but at least for now, let's not filter bindings of different
1213- // kinds so if we have a situation like: `Array<$T0> conv $T1`
1214- // and `$T1 conv Array<(String, Int)>` we can't lose `Array<$T0>`
1215- // as a binding because `$T0` could be inferred to
1216- // `(key: String, value: Int)` and binding `$T1` to `Array<(String, Int)>`
1217- // eagerly would be incorrect.
1218- if (existing->Kind != binding.Kind ) {
1219- // Array, Set and Dictionary allow conversions, everything else
1220- // requires their generic arguments to match exactly.
1221- if (existingType->isKnownStdlibCollectionType ())
1222- continue ;
1223- }
1211+ // FIXME: What is going on here needs to be thoroughly re-evaluated.
12241212
12251213 // If new type has a type variable it shouldn't
12261214 // be considered viable.
@@ -1276,8 +1264,7 @@ static bool hasConversions(Type type) {
12761264 }
12771265
12781266 return !(type->is <StructType>() || type->is <EnumType>() ||
1279- type->is <BuiltinType>() || type->is <ArchetypeType>() ||
1280- type->isVoid ());
1267+ type->is <BuiltinType>() || type->is <ArchetypeType>());
12811268}
12821269
12831270bool BindingSet::favoredOverDisjunction (Constraint *disjunction) const {
@@ -1293,16 +1280,9 @@ bool BindingSet::favoredOverDisjunction(Constraint *disjunction) const {
12931280
12941281 return !hasConversions (binding.BindingType );
12951282 })) {
1296- bool isApplicationResultType = TypeVar->getImpl ().isApplicationResultType ();
1297- if (llvm::none_of (Info.DelayedBy , [&isApplicationResultType](
1298- const Constraint *constraint) {
1299- // Let's not attempt to bind result type before application
1300- // happens. For example because it could be discardable or
1301- // l-value (subscript applications).
1302- if (isApplicationResultType &&
1303- constraint->getKind () == ConstraintKind::ApplicableFunction)
1304- return true ;
1305-
1283+ // Result type of subscript could be l-value so we can't bind it early.
1284+ if (!TypeVar->getImpl ().isSubscriptResultType () &&
1285+ llvm::none_of (Info.DelayedBy , [](const Constraint *constraint) {
13061286 return constraint->getKind () == ConstraintKind::Disjunction ||
13071287 constraint->getKind () == ConstraintKind::ValueMember;
13081288 }))
0 commit comments