Compute potential bindings with the help of the constraint graph.

Rather than performing a two-pass walk over all of the constraints in
the system to attach them to type variables, use the existing type
variable -> constraints mapping in the constraint graph to make this a
faster single-pass process. Also clarify the type bindings a little
bit. Improves type checking time for the standard library by ~3%.



Swift SVN r11098
This commit is contained in:
Doug Gregor
2013-12-10 23:25:37 +00:00
parent fb38d09bb1
commit 61318e33f0
4 changed files with 311 additions and 363 deletions

View File

@@ -1426,6 +1426,13 @@ ConstraintSystem::simplifyMemberConstraint(const Constraint &constraint) {
choices.push_back(OverloadChoice(baseTy, result.first,
/*isSpecialized=*/false));
}
if (choices.empty()) {
recordFailure(constraint.getLocator(), Failure::DoesNotHaveMember,
baseObjTy, name);
return SolutionKind::Error;
}
auto locator = getConstraintLocator(constraint.getLocator());
addOverloadSet(memberTy, choices, locator);
return SolutionKind::Solved;