Skip to content

Commit 38dc70f

Browse files
committed
[Generic signature builder] Include the parent in the name of a typealias PA.
1 parent b324249 commit 38dc70f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,19 @@ std::string GenericSignatureBuilder::PotentialArchetype::getDebugName() const {
136136
// Nested types.
137137
result += parent->getDebugName();
138138

139-
// When building the name for debugging purposes, include the
140-
// protocol into which the associated type was resolved.
139+
// When building the name for debugging purposes, include the protocol into
140+
// which the associated type or type alias was resolved.
141+
ProtocolDecl *proto = nullptr;
141142
if (auto assocType = getResolvedAssociatedType()) {
143+
proto = assocType->getProtocol();
144+
} else if (auto typeAlias = getTypeAliasDecl()) {
145+
proto = typeAlias->getParent()->getAsProtocolOrProtocolExtensionContext();
146+
}
147+
148+
if (proto) {
142149
result.push_back('[');
143150
result.push_back('.');
144-
result.append(assocType->getProtocol()->getName().str().begin(),
145-
assocType->getProtocol()->getName().str().end());
151+
result.append(proto->getName().str().begin(), proto->getName().str().end());
146152
result.push_back(']');
147153
}
148154

0 commit comments

Comments
 (0)