[Generic signature builder] Concrete constraints across equivalence classes.

When emitting a requirement for a same-type-to-concrete constraint,
use the known concrete source for just the first of the component
anchors. For the rest, we need to explicitly model the constraint lest
it get lost. Fixes rdar://problem/30478915.
This commit is contained in:
Doug Gregor
2017-02-13 12:43:53 -08:00
parent f6915546a2
commit e3479e25fc
2 changed files with 29 additions and 7 deletions

View File

@@ -2340,12 +2340,6 @@ void GenericSignatureBuilder::enumerateRequirements(llvm::function_ref<
if (archetype->isInvalid())
return true;
// If there is a concrete type above us, there are no requirements to
// emit.
if (archetype->getParent() &&
hasConcreteTypeInPath(archetype->getParent()))
return true;
// Keep it.
return false;
}),
@@ -2388,7 +2382,9 @@ void GenericSignatureBuilder::enumerateRequirements(llvm::function_ref<
// anchor with a concrete type.
if (auto concreteType = rep->getConcreteType()) {
f(RequirementKind::SameType, archetype, concreteType,
rep->getConcreteTypeSource());
knownAnchor == componentAnchors.begin()
? rep->getConcreteTypeSource()
: RequirementSource(RequirementSource::Explicit, SourceLoc()));
continue;
}