mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -57,11 +57,13 @@ public:
|
||||
:XMLEscapingPrinter(OS) { }
|
||||
|
||||
private:
|
||||
void printTypeRef(Type T, const TypeDecl *TD, Identifier Name) override {
|
||||
void printTypeRef(
|
||||
Type T, const TypeDecl *TD, Identifier Name,
|
||||
PrintNameContext NameContext = PrintNameContext::Normal) override {
|
||||
printXML("<Type usr=\"");
|
||||
SwiftLangSupport::printUSR(TD, OS);
|
||||
printXML("\">");
|
||||
StreamPrinter::printTypeRef(T, TD, Name);
|
||||
StreamPrinter::printTypeRef(T, TD, Name, NameContext);
|
||||
printXML("</Type>");
|
||||
}
|
||||
};
|
||||
@@ -272,11 +274,13 @@ private:
|
||||
closeTag(tag);
|
||||
}
|
||||
|
||||
void printTypeRef(Type T, const TypeDecl *TD, Identifier name) override {
|
||||
void printTypeRef(
|
||||
Type T, const TypeDecl *TD, Identifier name,
|
||||
PrintNameContext NameContext = PrintNameContext::Normal) override {
|
||||
auto tag = getTagForDecl(TD, /*isRef=*/true);
|
||||
openTagWithUSRForDecl(tag, TD);
|
||||
insideRef = true;
|
||||
XMLEscapingPrinter::printTypeRef(T, TD, name);
|
||||
XMLEscapingPrinter::printTypeRef(T, TD, name, NameContext);
|
||||
insideRef = false;
|
||||
closeTag(tag);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user