Handle nested types of concrete types in the constraint solver.

... I have no idea why we were foolishly mapping such things to their
parent type, which made no sense whatsoever. Fixes
rdar://problem/21621421.

Swift SVN r29882
This commit is contained in:
Doug Gregor
2015-07-02 04:45:15 +00:00
parent bf75dfe72d
commit 2038a8e837
3 changed files with 35 additions and 14 deletions

View File

@@ -468,7 +468,17 @@ namespace {
[&]() -> TypeVariableType* {
auto implArchetype = baseTypeVar->getImpl().getArchetype();
if (!implArchetype) {
return baseTypeVar;
// If the base type variable doesn't have an associated archetype,
// just form the member constraint.
// FIXME: Additional requirements?
auto locator = CS.getConstraintLocator(
Locator.withPathElement(member));
auto memberTypeVar = CS.createTypeVariable(locator,
TVO_PrefersSubtypeBinding);
CS.addConstraint(Constraint::create(CS, ConstraintKind::TypeMember,
baseTypeVar, memberTypeVar,
member->getName(), locator));
return memberTypeVar;
}