mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Capture complete associated type substitution information in the AST.
Previously, we only tracked the mapping from associated types to their type witnesses. Now, also track the protocol conformances for each of the requirements placed on the associated types. Swift SVN r6655
This commit is contained in:
@@ -727,8 +727,8 @@ Serializer::writeConformances(ArrayRef<ProtocolDecl *> protocols,
|
||||
++numValueWitnesses;
|
||||
}
|
||||
for (auto typeMapping : conf->getTypeWitnesses()) {
|
||||
data.push_back(addTypeRef(typeMapping.first));
|
||||
data.push_back(addTypeRef(typeMapping.second));
|
||||
data.push_back(addDeclRef(typeMapping.first));
|
||||
// The substitution record is serialized later.
|
||||
++numTypeWitnesses;
|
||||
}
|
||||
for (auto defaulted : conf->getDefaultedDefinitions()) {
|
||||
@@ -756,6 +756,8 @@ Serializer::writeConformances(ArrayRef<ProtocolDecl *> protocols,
|
||||
writeConformances(inheritedProtos, inheritedConformance);
|
||||
for (auto valueMapping : conf->getWitnesses())
|
||||
writeSubstitutions(valueMapping.second.Substitutions);
|
||||
for (auto typeMapping : conf->getTypeWitnesses())
|
||||
writeSubstitutions(typeMapping.second);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -763,9 +765,11 @@ void Serializer::writeSubstitutions(ArrayRef<Substitution> substitutions) {
|
||||
using namespace decls_block;
|
||||
auto abbrCode = DeclTypeAbbrCodes[BoundGenericSubstitutionLayout::Code];
|
||||
for (auto &sub : substitutions) {
|
||||
BoundGenericSubstitutionLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addTypeRef(sub.Archetype),
|
||||
addTypeRef(sub.Replacement));
|
||||
BoundGenericSubstitutionLayout::emitRecord(
|
||||
Out, ScratchRecord, abbrCode,
|
||||
addTypeRef(sub.Archetype),
|
||||
addTypeRef(sub.Replacement),
|
||||
sub.Archetype->getConformsTo().size());
|
||||
writeConformances(sub.Archetype->getConformsTo(), sub.Conformance);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user