@@ -720,6 +720,21 @@ swift::Demangle::NodePointer TypeSystemSwiftTypeRef::GetDemangleTreeForPrinting(
720
720
return canonical;
721
721
}
722
722
723
+ // / Determine wether this demangle tree contains an unresolved type alias.
724
+ static bool ContainsGenericTypeParameter (swift::Demangle::NodePointer node) {
725
+ if (!node)
726
+ return false ;
727
+
728
+ if (node->getKind () == swift::Demangle::Node::Kind::DependentGenericParamType)
729
+ return true ;
730
+
731
+ for (swift::Demangle::NodePointer child : *node)
732
+ if (ContainsGenericTypeParameter (child))
733
+ return true ;
734
+
735
+ return false ;
736
+ }
737
+
723
738
// / Collect TypeInfo flags from a demangle tree. For most attributes
724
739
// / this can stop scanning at the outmost type, however in order to
725
740
// / determine whether a node is generic or not, it needs to visit all
@@ -770,7 +785,6 @@ static uint32_t collectTypeInfo(SwiftASTContext *module_holder,
770
785
}
771
786
else
772
787
switch (node->getKind ()) {
773
-
774
788
case Node::Kind::SugaredOptional:
775
789
swift_flags |= eTypeIsGeneric | eTypeIsBound | eTypeHasChildren |
776
790
eTypeHasValue | eTypeIsEnumeration;
@@ -818,8 +832,8 @@ static uint32_t collectTypeInfo(SwiftASTContext *module_holder,
818
832
node->getText () == swift::BUILTIN_TYPE_NAME_UNKNOWNOBJECT)
819
833
swift_flags |=
820
834
eTypeHasChildren | eTypeIsPointer | eTypeIsScalar | eTypeIsObjC;
821
- else if (node->getText () == swift::BUILTIN_TYPE_NAME_FLOAT ||
822
- node->getText () == swift::BUILTIN_TYPE_NAME_FLOAT_PPC)
835
+ else if (node->getText (). startswith ( swift::BUILTIN_TYPE_NAME_FLOAT) ||
836
+ node->getText (). startswith ( swift::BUILTIN_TYPE_NAME_FLOAT_PPC) )
823
837
swift_flags |= eTypeIsFloat | eTypeIsScalar;
824
838
else if (node->getText ().startswith (swift::BUILTIN_TYPE_NAME_VEC))
825
839
swift_flags |= eTypeHasChildren | eTypeIsVector;
@@ -841,8 +855,7 @@ static uint32_t collectTypeInfo(SwiftASTContext *module_holder,
841
855
if (node->getNumChildren () != 2 )
842
856
break ;
843
857
// Bug-for-bug compatibility.
844
- if (!(collectTypeInfo (module_holder, dem, node->getChild (1 )) &
845
- eTypeIsGenericTypeParam))
858
+ if (!ContainsGenericTypeParameter (node->getChild (1 )))
846
859
swift_flags |= eTypeHasValue | eTypeHasChildren;
847
860
auto module = node->getChild (0 );
848
861
if (module ->hasText () &&
0 commit comments