Sema: Don't create locators with null archetypes.

And remove a stray assert(false) that shouldn't be there that I noticed by inspection.

Swift SVN r14903
This commit is contained in:
Joe Groff
2014-03-11 01:56:35 +00:00
parent ed80c68cb5
commit 24e9fed6db

View File

@@ -417,8 +417,9 @@ namespace {
auto nestedType = baseTypeVar->getImpl().getArchetype()
->getNestedType(member->getName());
auto archetype = nestedType.dyn_cast<ArchetypeType*>();
auto locator = CS.getConstraintLocator((Expr *)nullptr,
LocatorPathElt(archetype));
auto locator = archetype
? CS.getConstraintLocator((Expr *)nullptr, LocatorPathElt(archetype))
: nullptr;
auto memberTypeVar = CS.createTypeVariable(locator,
TVO_PrefersSubtypeBinding);
// Determine whether we should bind the new type variable as a
@@ -447,7 +448,6 @@ namespace {
// Add associated type constraints.
if (!archetype) {
assert(false);
// If the nested type is not an archetype (because it was constrained
// to a concrete type by a requirement), bind the type variable
// to that type.