@@ -1208,19 +1208,7 @@ bool BindingSet::isViable(PotentialBinding &binding, bool isTransitive) {
1208
1208
if (!existingNTD || NTD != existingNTD)
1209
1209
continue ;
1210
1210
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.
1224
1212
1225
1213
// If new type has a type variable it shouldn't
1226
1214
// be considered viable.
@@ -1276,8 +1264,7 @@ static bool hasConversions(Type type) {
1276
1264
}
1277
1265
1278
1266
return !(type->is <StructType>() || type->is <EnumType>() ||
1279
- type->is <BuiltinType>() || type->is <ArchetypeType>() ||
1280
- type->isVoid ());
1267
+ type->is <BuiltinType>() || type->is <ArchetypeType>());
1281
1268
}
1282
1269
1283
1270
bool BindingSet::favoredOverDisjunction (Constraint *disjunction) const {
@@ -1293,16 +1280,9 @@ bool BindingSet::favoredOverDisjunction(Constraint *disjunction) const {
1293
1280
1294
1281
return !hasConversions (binding.BindingType );
1295
1282
})) {
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) {
1306
1286
return constraint->getKind () == ConstraintKind::Disjunction ||
1307
1287
constraint->getKind () == ConstraintKind::ValueMember;
1308
1288
}))
0 commit comments