mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[serialization] Add support for slice types and variadic functions.
This is the first time reaching the case where the module refers to a type that also appears in the TU and tries to modify it. This shouldn't be a problem for any of the other types we currently serialize besides BoundGenericType and ArraySliceType because we either don't try to modify them after creation or are guaranteed a new type object. Swift SVN r6060
This commit is contained in:
@@ -1207,6 +1207,11 @@ Type ModuleFile::getType(TypeID TID) {
|
||||
getType(parentID), genericArgs);
|
||||
typeOrOffset = boundTy;
|
||||
|
||||
// BoundGenericTypes get uniqued in the ASTContext, so it's possible this
|
||||
// type already has its substitutions. In that case, ignore the module's.
|
||||
if (boundTy->hasSubstitutions())
|
||||
break;
|
||||
|
||||
SmallVector<Substitution, 8> substitutions;
|
||||
while (true) {
|
||||
auto entry = DeclTypeCursor.advance();
|
||||
@@ -1289,6 +1294,20 @@ Type ModuleFile::getType(TypeID TID) {
|
||||
break;
|
||||
}
|
||||
|
||||
case decls_block::ARRAY_SLICE_TYPE: {
|
||||
TypeID baseID, implID;
|
||||
decls_block::ArraySliceTypeLayout::readRecord(scratch, baseID, implID);
|
||||
|
||||
auto sliceTy = ArraySliceType::get(getType(baseID), ctx);
|
||||
typeOrOffset = sliceTy;
|
||||
|
||||
// Slice types are uniqued by the ASTContext, so they may already have
|
||||
// type information. If so, ignore the information in the module.
|
||||
if (!sliceTy->hasImplementationType())
|
||||
sliceTy->setImplementationType(getType(implID));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
// We don't know how to deserialize this kind of type.
|
||||
error();
|
||||
|
||||
Reference in New Issue
Block a user