@@ -2643,6 +2643,7 @@ class DiagnosisEmitter : public SDKNodeVisitor {
2643
2643
void visitDecl (SDKNodeDecl *D);
2644
2644
void visit (NodePtr Node) override ;
2645
2645
SDKNodeDecl *findAddedDecl (const SDKNodeDecl *Node);
2646
+ bool findTypeAliasDecl (const SDKNodeDecl *Node);
2646
2647
static StringRef printName (StringRef Name);
2647
2648
static StringRef printDiagKeyword (StringRef Name);
2648
2649
static void collectAddedDecls (NodePtr Root, std::set<SDKNodeDecl*> &Results);
@@ -2766,6 +2767,16 @@ SDKNodeDecl *DiagnosisEmitter::findAddedDecl(const SDKNodeDecl *Root) {
2766
2767
return nullptr ;
2767
2768
}
2768
2769
2770
+ bool DiagnosisEmitter::findTypeAliasDecl (const SDKNodeDecl *Node) {
2771
+ if (Node->getKind () != SDKNodeKind::TypeDecl)
2772
+ return false ;
2773
+ return std::any_of (AddedDecls.begin (), AddedDecls.end (),
2774
+ [&](SDKNodeDecl *Added) {
2775
+ return Added->getKind () == SDKNodeKind::TypeAlias &&
2776
+ Added->getPrintedName () == Node->getPrintedName ();
2777
+ });
2778
+ }
2779
+
2769
2780
StringRef DiagnosisEmitter::printName (StringRef Name) {
2770
2781
OSColor Color (llvm::outs (), llvm::raw_ostream::CYAN);
2771
2782
Color << Name;
@@ -2861,6 +2872,10 @@ void DiagnosisEmitter::handle(const SDKNodeDecl *Node, NodeAnnotation Anno) {
2861
2872
auto &Ctx = Node->getSDKContext ();
2862
2873
switch (Anno) {
2863
2874
case NodeAnnotation::Removed: {
2875
+ // If we can find a type alias decl with the same name of this type, we
2876
+ // consider the type is not removed.
2877
+ if (findTypeAliasDecl (Node))
2878
+ return ;
2864
2879
if (auto *Added = findAddedDecl (Node)) {
2865
2880
if (Node->getDeclKind () != DeclKind::Constructor) {
2866
2881
MovedDecls.Diags .emplace_back (Node->getDeclKind (),
0 commit comments