Merge pull request #28221 from DougGregor/reduce-depth-maps

Reduce usage of expression depth maps
This commit is contained in:
Doug Gregor
2019-11-12 20:43:14 -08:00
committed by GitHub
4 changed files with 49 additions and 34 deletions

View File

@@ -2700,7 +2700,6 @@ bool ConstraintSystem::diagnoseAmbiguity(Expr *expr,
// Heuristically, all other things being equal, we should complain about the
// ambiguous expression that (1) has the most overloads, (2) is deepest, or
// (3) comes earliest in the expression.
auto depthMap = expr->getDepthMap();
auto indexMap = expr->getPreorderIndexMap();
for (unsigned i = 0, n = diff.overloads.size(); i != n; ++i) {
@@ -2716,10 +2715,10 @@ bool ConstraintSystem::diagnoseAmbiguity(Expr *expr,
continue;
unsigned index = it->second;
auto e = depthMap.find(anchor);
if (e == depthMap.end())
auto optDepth = getExprDepth(anchor);
if (!optDepth)
continue;
unsigned depth = e->second.first;
unsigned depth = *optDepth;
// If we don't have a name to hang on to, it'll be hard to diagnose this
// overload.