Skip to content

Implement typeref to demangle tree conversion for nested bound generics #59326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions stdlib/public/Reflection/TypeRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,25 @@ class DemanglingForTypeRef
nominalNode->addChild(parentNode, Dem);
nominalNode->addChild(identifierNode, Dem);

// Peel off the "Type" node.
parentNode = parentNode->getFirstChild();

auto nominalNode = unspecializedType->getFirstChild();

if (nominalNode->getNumChildren() != 2)
return genericNode;

// Save identifier for reinsertion later, we have to remove it
// so we can insert the parent node as the first child.
auto identifierNode = nominalNode->getLastChild();

// Remove all children.
nominalNode->removeChildAt(1);
nominalNode->removeChildAt(0);

// Add the parent we just visited back in, followed by the identifier.
nominalNode->addChild(parentNode, Dem);
nominalNode->addChild(identifierNode, Dem);
return genericNode;
}

Expand Down