@@ -2424,75 +2424,6 @@ class ConstraintSystem {
2424
2424
SynthesizedConformances;
2425
2425
2426
2426
private:
2427
- // / Describe the candidate expression for partial solving.
2428
- // / This class used by shrink & solve methods which apply
2429
- // / variation of directional path consistency algorithm in attempt
2430
- // / to reduce scopes of the overload sets (disjunctions) in the system.
2431
- class Candidate {
2432
- Expr *E;
2433
- DeclContext *DC;
2434
- llvm::BumpPtrAllocator &Allocator;
2435
-
2436
- // Contextual Information.
2437
- Type CT;
2438
- ContextualTypePurpose CTP;
2439
-
2440
- public:
2441
- Candidate (ConstraintSystem &cs, Expr *expr, Type ct = Type(),
2442
- ContextualTypePurpose ctp = ContextualTypePurpose::CTP_Unused)
2443
- : E(expr), DC(cs.DC), Allocator(cs.Allocator), CT(ct), CTP(ctp) {}
2444
-
2445
- // / Return underlying expression.
2446
- Expr *getExpr () const { return E; }
2447
-
2448
- // / Try to solve this candidate sub-expression
2449
- // / and re-write it's OSR domains afterwards.
2450
- // /
2451
- // / \param shrunkExprs The set of expressions which
2452
- // / domains have been successfully shrunk so far.
2453
- // /
2454
- // / \returns true on solver failure, false otherwise.
2455
- bool solve (llvm::SmallSetVector<OverloadSetRefExpr *, 4 > &shrunkExprs);
2456
-
2457
- // / Apply solutions found by solver as reduced OSR sets for
2458
- // / for current and all of it's sub-expressions.
2459
- // /
2460
- // / \param solutions The solutions found by running solver on the
2461
- // / this candidate expression.
2462
- // /
2463
- // / \param shrunkExprs The set of expressions which
2464
- // / domains have been successfully shrunk so far.
2465
- void applySolutions (
2466
- llvm::SmallVectorImpl<Solution> &solutions,
2467
- llvm::SmallSetVector<OverloadSetRefExpr *, 4 > &shrunkExprs) const ;
2468
-
2469
- // / Check if attempt at solving of the candidate makes sense given
2470
- // / the current conditions - number of shrunk domains which is related
2471
- // / to the given candidate over the total number of disjunctions present.
2472
- static bool
2473
- isTooComplexGiven (ConstraintSystem *const cs,
2474
- llvm::SmallSetVector<OverloadSetRefExpr *, 4 > &shrunkExprs) {
2475
- SmallVector<Constraint *, 8 > disjunctions;
2476
- cs->collectDisjunctions (disjunctions);
2477
-
2478
- unsigned unsolvedDisjunctions = disjunctions.size ();
2479
- for (auto *disjunction : disjunctions) {
2480
- auto *locator = disjunction->getLocator ();
2481
- if (!locator)
2482
- continue ;
2483
-
2484
- if (auto *OSR = getAsExpr<OverloadSetRefExpr>(locator->getAnchor ())) {
2485
- if (shrunkExprs.count (OSR) > 0 )
2486
- --unsolvedDisjunctions;
2487
- }
2488
- }
2489
-
2490
- unsigned threshold =
2491
- cs->getASTContext ().TypeCheckerOpts .SolverShrinkUnsolvedThreshold ;
2492
- return unsolvedDisjunctions >= threshold;
2493
- }
2494
- };
2495
-
2496
2427
// / Describes the current solver state.
2497
2428
struct SolverState {
2498
2429
SolverState (ConstraintSystem &cs,
@@ -5280,15 +5211,6 @@ class ConstraintSystem {
5280
5211
// / \returns true if an error occurred, false otherwise.
5281
5212
bool solveSimplified (SmallVectorImpl<Solution> &solutions);
5282
5213
5283
- // / Find reduced domains of disjunction constraints for given
5284
- // / expression, this is achieved to solving individual sub-expressions
5285
- // / and combining resolving types. Such algorithm is called directional
5286
- // / path consistency because it goes from children to parents for all
5287
- // / related sub-expressions taking union of their domains.
5288
- // /
5289
- // / \param expr The expression to find reductions for.
5290
- void shrink (Expr *expr);
5291
-
5292
5214
// / Pick a disjunction from the InactiveConstraints list.
5293
5215
// /
5294
5216
// / \returns The selected disjunction.
0 commit comments