mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Serialization: Fix deserialization of generic typealiases
The recovery logic was erronously kicking in, because it was comparing the substituted underlying type with the declaration's underlying type. For a generic typealias, these never equal, so instead, serialize the unsubstituted type, and substitute it in deserialization.
This commit is contained in:
@@ -3625,13 +3625,14 @@ void Serializer::writeType(Type ty) {
|
||||
case TypeKind::NameAlias: {
|
||||
auto alias = cast<NameAliasType>(ty.getPointer());
|
||||
const TypeAliasDecl *typeAlias = alias->getDecl();
|
||||
auto underlyingType = typeAlias->getUnderlyingTypeLoc().getType();
|
||||
|
||||
unsigned abbrCode = DeclTypeAbbrCodes[NameAliasTypeLayout::Code];
|
||||
NameAliasTypeLayout::emitRecord(
|
||||
Out, ScratchRecord, abbrCode,
|
||||
addDeclRef(typeAlias, /*allowTypeAliasXRef*/true),
|
||||
addTypeRef(alias->getParent()),
|
||||
addTypeRef(alias->getSinglyDesugaredType()),
|
||||
addTypeRef(underlyingType),
|
||||
addSubstitutionMapRef(alias->getSubstitutionMap()));
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user