@@ -1342,63 +1342,6 @@ static void determineBestChoicesInContext(
1342
1342
}
1343
1343
}
1344
1344
1345
- // Attempt to find a disjunction of bind constraints where all options
1346
- // in the disjunction are binding the same type variable.
1347
- //
1348
- // Prefer disjunctions where the bound type variable is also the
1349
- // right-hand side of a conversion constraint, since having a concrete
1350
- // type that we're converting to can make it possible to split the
1351
- // constraint system into multiple ones.
1352
- static Constraint *
1353
- selectBestBindingDisjunction (ConstraintSystem &cs,
1354
- SmallVectorImpl<Constraint *> &disjunctions) {
1355
-
1356
- if (disjunctions.empty ())
1357
- return nullptr ;
1358
-
1359
- auto getAsTypeVar = [&cs](Type type) {
1360
- return cs.simplifyType (type)->getRValueType ()->getAs <TypeVariableType>();
1361
- };
1362
-
1363
- Constraint *firstBindDisjunction = nullptr ;
1364
- for (auto *disjunction : disjunctions) {
1365
- auto choices = disjunction->getNestedConstraints ();
1366
- assert (!choices.empty ());
1367
-
1368
- auto *choice = choices.front ();
1369
- if (choice->getKind () != ConstraintKind::Bind)
1370
- continue ;
1371
-
1372
- // We can judge disjunction based on the single choice
1373
- // because all of choices (of bind overload set) should
1374
- // have the same left-hand side.
1375
- // Only do this for simple type variable bindings, not for
1376
- // bindings like: ($T1) -> $T2 bind String -> Int
1377
- auto *typeVar = getAsTypeVar (choice->getFirstType ());
1378
- if (!typeVar)
1379
- continue ;
1380
-
1381
- if (!firstBindDisjunction)
1382
- firstBindDisjunction = disjunction;
1383
-
1384
- auto constraints = cs.getConstraintGraph ().gatherNearbyConstraints (
1385
- typeVar, [](Constraint *constraint) {
1386
- return constraint->getKind () == ConstraintKind::Conversion;
1387
- });
1388
-
1389
- for (auto *constraint : constraints) {
1390
- if (typeVar == getAsTypeVar (constraint->getSecondType ()))
1391
- return disjunction;
1392
- }
1393
- }
1394
-
1395
- // If we had any binding disjunctions, return the first of
1396
- // those. These ensure that we attempt to bind types earlier than
1397
- // trying the elements of other disjunctions, which can often mean
1398
- // we fail faster.
1399
- return firstBindDisjunction;
1400
- }
1401
-
1402
1345
// / Prioritize `build{Block, Expression, ...}` and any chained
1403
1346
// / members that are connected to individual builder elements
1404
1347
// / i.e. `ForEach(...) { ... }.padding(...)`, once `ForEach`
@@ -1486,9 +1429,6 @@ ConstraintSystem::selectDisjunction() {
1486
1429
if (disjunctions.empty ())
1487
1430
return std::nullopt;
1488
1431
1489
- if (auto *disjunction = selectBestBindingDisjunction (*this , disjunctions))
1490
- return std::make_pair (disjunction, llvm::TinyPtrVector<Constraint *>());
1491
-
1492
1432
llvm::DenseMap<Constraint *, DisjunctionInfo> favorings;
1493
1433
determineBestChoicesInContext (*this , disjunctions, favorings);
1494
1434
0 commit comments