@@ -105,20 +105,28 @@ class UnboundGenericType extends ValueOrRefType, UnboundGeneric {
105105
106106 override Location getALocation ( ) { type_location ( this , result ) }
107107
108- /** Gets the name of this generic type without the `<...>` brackets. */
109- string getNameWithoutBrackets ( ) {
110- result = getName ( ) .prefix ( getName ( ) .length ( ) - getNumberOfTypeParameters ( ) - 1 )
108+ override UnboundGenericType getUnboundDeclaration ( ) {
109+ result = ValueOrRefType .super .getUnboundDeclaration ( )
110+ }
111+
112+ final override Type getChild ( int n ) { result = getTypeParameter ( n ) }
113+
114+ private string getTypeParameterCommas ( ) {
115+ result = strictconcat ( int i | exists ( this .getTypeParameter ( i ) ) | "" , "," )
111116 }
112117
113118 override string toStringWithTypes ( ) {
114- result = getNameWithoutBrackets ( ) + "<" + this .typeParametersToString ( ) + ">"
119+ result = this . getNameWithoutBrackets ( ) + "<" + this .typeParametersToString ( ) + ">"
115120 }
116121
117- override UnboundGenericType getUnboundDeclaration ( ) {
118- result = ValueOrRefType . super . getUnboundDeclaration ( )
122+ final override string getName ( ) {
123+ result = this . getNameWithoutBrackets ( ) + "<" + this . getTypeParameterCommas ( ) + ">"
119124 }
120125
121- final override Type getChild ( int n ) { result = getTypeParameter ( n ) }
126+ final override predicate hasQualifiedName ( string qualifier , string name ) {
127+ super .hasQualifiedName ( qualifier , _) and
128+ name = this .getNameWithoutBrackets ( ) + "<" + this .getTypeParameterCommas ( ) + ">"
129+ }
122130}
123131
124132/**
@@ -360,22 +368,51 @@ class ConstructedType extends ValueOrRefType, ConstructedGeneric {
360368
361369 override UnboundGenericType getUnboundGeneric ( ) { constructed_generic ( this , getTypeRef ( result ) ) }
362370
363- override string toStringWithTypes ( ) {
371+ final override Type getChild ( int n ) { result = getTypeArgument ( n ) }
372+
373+ language [ monotonicAggregates]
374+ private string getTypeArgumentsString ( ) {
364375 result =
365- getUnboundGeneric ( ) . getNameWithoutBrackets ( ) + "<" + this .getTypeArgumentsString ( ) + ">"
376+ strictconcat ( Type t , int i | t = this .getTypeArgument ( i ) | t . toString ( ) , ", " order by i )
366377 }
367378
368- final override Type getChild ( int n ) { result = getTypeArgument ( n ) }
379+ language [ monotonicAggregates]
380+ private string getTypeArgumentsNames ( ) {
381+ result =
382+ strictconcat ( Type t , int i | t = this .getTypeArgument ( i ) | t .getName ( ) , ", " order by i )
383+ }
369384
370385 language [ monotonicAggregates]
371- private string getTypeArgumentsString ( ) {
386+ private string getTypeArgumentsQualifiedNames ( ) {
372387 result =
373- concat ( int i |
374- exists ( this .getTypeArgument ( i ) )
388+ strictconcat ( Type t , int i |
389+ t = this .getTypeArgument ( i )
375390 |
376- this . getTypeArgument ( i ) . toString ( ) , ", " order by i
391+ t . getQualifiedName ( ) , "," order by i
377392 )
378393 }
394+
395+ final override string toStringWithTypes ( ) {
396+ exists ( string undecorated |
397+ types ( this , _, undecorated ) and
398+ result = undecorated + "<" + this .getTypeArgumentsString ( ) + ">"
399+ )
400+ }
401+
402+ final override string getName ( ) {
403+ exists ( string undecorated |
404+ types ( this , _, undecorated ) and
405+ result = undecorated + "<" + this .getTypeArgumentsNames ( ) + ">"
406+ )
407+ }
408+
409+ final override predicate hasQualifiedName ( string qualifier , string name ) {
410+ exists ( string undecorated |
411+ super .hasQualifiedName ( qualifier , _) and
412+ types ( this , _, undecorated ) and
413+ name = undecorated + "<" + this .getTypeArgumentsQualifiedNames ( ) + ">"
414+ )
415+ }
379416}
380417
381418/**
0 commit comments