[ModuleInterfaces] Escape Type and Protocol when module-qualifying

If we see `MyModule.Type`, the parser thinks this is a metatype type.
Escape the name `Type` so the parser can recognize it's a type name.

Fixes [SR-11422](https://bugs.swift.org/browse/SR-11422) rdar://55094784
This commit is contained in:
Harlan Haskins
2019-09-05 18:16:24 -07:00
parent 568f615a09
commit 2893d96927
8 changed files with 105 additions and 69 deletions

View File

@@ -241,10 +241,12 @@ public:
deinitDefaultMapToUse(D);
}
void printTypeRef(Type T, const TypeDecl *TD, Identifier Name) override {
void printTypeRef(
Type T, const TypeDecl *TD, Identifier Name,
PrintNameContext NameContext = PrintNameContext::Normal) override {
unsigned StartOffset = OS.tell();
References.emplace_back(TD, StartOffset, Name.str().size());
StreamPrinter::printTypeRef(T, TD, Name);
StreamPrinter::printTypeRef(T, TD, Name, NameContext);
}
};