[Serialization] Allow unbound generic types to cross-reference typealias decls

Ideally `UnboundGenericType` should never be serialized but it is
currently allowed to make generic `typealias` declarations without
specifying generic parameters, so it should be allowed to cross
reference typealias decls in such types as well because `NameAliasType`
can't be used until generic parameters are resolved.

This is only a temporary fix and more comprehensive solution is still
pending here, most likely such declarations should not produce
`UnboundGenericType` but instead should copy generic parameters from
underlying type and produce proper `NameAliasType`.

Resolves: rdar://problem/37384120
This commit is contained in:
Pavel Yaskevich
2018-05-22 18:17:21 -07:00
parent a53cf99ef6
commit 7ed3d754b5
3 changed files with 9 additions and 1 deletions

View File

@@ -3943,7 +3943,9 @@ void Serializer::writeType(Type ty) {
unsigned abbrCode = DeclTypeAbbrCodes[UnboundGenericTypeLayout::Code];
UnboundGenericTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
addDeclRef(generic->getDecl()),
addDeclRef(generic->getDecl(),
/*forceSerialization*/false,
/*allowTypeAliasXRef*/true),
addTypeRef(generic->getParent()));
break;
}