[Type checker] Be more rigorous about extracting argument labels from calls.

Whenever we have a call, retrieve the argument labels from the
argument structurally and associate them with the callee. We were
previously doing this as a separate AST walk (which was unnecessary),
so fold that into constraint generation for a CallExpr.

This is a slightly-pared-back version of
3753d779bc that isn't so rigid in its
interpretation of ASTs. I'll tighten up the semantics over time.
This commit is contained in:
Doug Gregor
2016-06-03 14:39:42 -07:00
parent 4a60b6cbf4
commit 93dac8f759
7 changed files with 110 additions and 91 deletions

View File

@@ -2612,8 +2612,8 @@ getArgumentLabels(ConstraintSystem &cs, ConstraintLocatorBuilder locator) {
if (!parts.empty())
return None;
auto known = cs.ArgumentLabels.find(cs.getConstraintLocator(anchor));
if (known == cs.ArgumentLabels.end())
auto known = cs.CalleeArgumentLabels.find(cs.getConstraintLocator(anchor));
if (known == cs.CalleeArgumentLabels.end())
return None;
return known->second;