mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[GenericSigBuilder] Archetypes no longer make it to this path. NFC
This commit is contained in:
@@ -1916,37 +1916,35 @@ bool GenericSignatureBuilder::addSameTypeRequirementToConcrete(
|
|||||||
// Make sure the concrete type fulfills the requirements on the archetype.
|
// Make sure the concrete type fulfills the requirements on the archetype.
|
||||||
// FIXME: Move later...
|
// FIXME: Move later...
|
||||||
DenseMap<ProtocolDecl *, ProtocolConformanceRef> conformances;
|
DenseMap<ProtocolDecl *, ProtocolConformanceRef> conformances;
|
||||||
if (!Concrete->is<ArchetypeType>()) {
|
CanType depTy = rep->getDependentType({ }, /*allowUnresolved=*/true)
|
||||||
CanType depTy = rep->getDependentType({ }, /*allowUnresolved=*/true)
|
->getCanonicalType();
|
||||||
->getCanonicalType();
|
for (auto &conforms : rep->getConformsTo()) {
|
||||||
for (auto &conforms : rep->getConformsTo()) {
|
auto protocol = conforms.first;
|
||||||
auto protocol = conforms.first;
|
auto conformance =
|
||||||
auto conformance =
|
getLookupConformanceFn()(depTy, Concrete,
|
||||||
getLookupConformanceFn()(depTy, Concrete,
|
protocol->getDeclaredInterfaceType()
|
||||||
protocol->getDeclaredInterfaceType()
|
->castTo<ProtocolType>());
|
||||||
->castTo<ProtocolType>());
|
if (!conformance) {
|
||||||
if (!conformance) {
|
Diags.diagnose(Source->getLoc(),
|
||||||
Diags.diagnose(Source->getLoc(),
|
diag::requires_generic_param_same_type_does_not_conform,
|
||||||
diag::requires_generic_param_same_type_does_not_conform,
|
Concrete, protocol->getName());
|
||||||
Concrete, protocol->getName());
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
conformances.insert({protocol, *conformance});
|
|
||||||
|
|
||||||
// Abstract conformances are acceptable for existential types.
|
|
||||||
assert(conformance->isConcrete() || Concrete->isExistentialType());
|
|
||||||
|
|
||||||
// Update the requirement source now that we know it's concrete.
|
|
||||||
// FIXME: Bad concrete source info.
|
|
||||||
auto concreteSource = Source->viaConcrete(*this,
|
|
||||||
conformance->isConcrete()
|
|
||||||
? conformance->getConcrete()
|
|
||||||
: nullptr);
|
|
||||||
updateRequirementSource(conforms.second, concreteSource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conformances.insert({protocol, *conformance});
|
||||||
|
|
||||||
|
// Abstract conformances are acceptable for existential types.
|
||||||
|
assert(conformance->isConcrete() || Concrete->isExistentialType());
|
||||||
|
|
||||||
|
// Update the requirement source now that we know it's concrete.
|
||||||
|
// FIXME: Bad concrete source info.
|
||||||
|
auto concreteSource = Source->viaConcrete(*this,
|
||||||
|
conformance->isConcrete()
|
||||||
|
? conformance->getConcrete()
|
||||||
|
: nullptr);
|
||||||
|
updateRequirementSource(conforms.second, concreteSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record the requirement.
|
// Record the requirement.
|
||||||
rep->ConcreteType = Concrete;
|
rep->ConcreteType = Concrete;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user