@@ -105,20 +105,28 @@ class UnboundGenericType extends ValueOrRefType, UnboundGeneric {
105
105
106
106
override Location getALocation ( ) { type_location ( this , result ) }
107
107
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 ) ) | "" , "," )
111
116
}
112
117
113
118
override string toStringWithTypes ( ) {
114
- result = getNameWithoutBrackets ( ) + "<" + this .typeParametersToString ( ) + ">"
119
+ result = this . getNameWithoutBrackets ( ) + "<" + this .typeParametersToString ( ) + ">"
115
120
}
116
121
117
- override UnboundGenericType getUnboundDeclaration ( ) {
118
- result = ValueOrRefType . super . getUnboundDeclaration ( )
122
+ final override string getName ( ) {
123
+ result = this . getNameWithoutBrackets ( ) + "<" + this . getTypeParameterCommas ( ) + ">"
119
124
}
120
125
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
+ }
122
130
}
123
131
124
132
/**
@@ -360,22 +368,51 @@ class ConstructedType extends ValueOrRefType, ConstructedGeneric {
360
368
361
369
override UnboundGenericType getUnboundGeneric ( ) { constructed_generic ( this , getTypeRef ( result ) ) }
362
370
363
- override string toStringWithTypes ( ) {
371
+ final override Type getChild ( int n ) { result = getTypeArgument ( n ) }
372
+
373
+ language [ monotonicAggregates]
374
+ private string getTypeArgumentsString ( ) {
364
375
result =
365
- getUnboundGeneric ( ) . getNameWithoutBrackets ( ) + "<" + this .getTypeArgumentsString ( ) + ">"
376
+ strictconcat ( Type t , int i | t = this .getTypeArgument ( i ) | t . toString ( ) , ", " order by i )
366
377
}
367
378
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
+ }
369
384
370
385
language [ monotonicAggregates]
371
- private string getTypeArgumentsString ( ) {
386
+ private string getTypeArgumentsQualifiedNames ( ) {
372
387
result =
373
- concat ( int i |
374
- exists ( this .getTypeArgument ( i ) )
388
+ strictconcat ( Type t , int i |
389
+ t = this .getTypeArgument ( i )
375
390
|
376
- this . getTypeArgument ( i ) . toString ( ) , ", " order by i
391
+ t . getQualifiedName ( ) , "," order by i
377
392
)
378
393
}
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
+ }
379
416
}
380
417
381
418
/**
0 commit comments