mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #28221 from DougGregor/reduce-depth-maps
Reduce usage of expression depth maps
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user