@@ -71,9 +71,7 @@ class ConstructedGeneric extends DotNet::ConstructedGeneric, Generic {
7171 override Type getATypeArgument ( ) { result = getTypeArgument ( _) }
7272
7373 /** Gets the annotated type of type argument `i`. */
74- final AnnotatedType getAnnotatedTypeArgument ( int i ) {
75- result .appliesToTypeArgument ( this , i )
76- }
74+ final AnnotatedType getAnnotatedTypeArgument ( int i ) { result .appliesToTypeArgument ( this , i ) }
7775}
7876
7977/**
@@ -134,16 +132,16 @@ class TypeParameter extends DotNet::TypeParameter, Type, @type_parameter {
134132 override predicate isRefType ( ) {
135133 exists ( TypeParameterConstraints tpc | tpc = getConstraints ( ) |
136134 tpc .hasRefTypeConstraint ( ) or
137- exists ( tpc .getClassConstraint ( ) ) or
138- tpc .getATypeParameterConstraint ( ) .isRefType ( )
135+ tpc .getATypeConstraint ( ) instanceof Class or
136+ tpc .getATypeConstraint ( ) . ( TypeParameter ) .isRefType ( )
139137 // NB: an interface constraint is not a guarantee, as structs can implement interfaces
140138 )
141139 }
142140
143141 override predicate isValueType ( ) {
144142 exists ( TypeParameterConstraints tpc | tpc = getConstraints ( ) |
145143 tpc .hasValueTypeConstraint ( ) or
146- tpc .getATypeParameterConstraint ( ) .isValueType ( )
144+ tpc .getATypeConstraint ( ) . ( TypeParameter ) .isValueType ( )
147145 )
148146 }
149147
@@ -201,23 +199,29 @@ class TypeParameter extends DotNet::TypeParameter, Type, @type_parameter {
201199 * ```
202200 */
203201class TypeParameterConstraints extends Element , @type_parameter_constraints {
204- /** Gets a specific interface constraint, if any. */
205- Interface getAnInterfaceConstraint ( ) {
206- specific_type_parameter_constraints ( this , getTypeRef ( result ) )
207- }
202+ /**
203+ * DEPRECATED: Use `getATypeConstraint()` instead.
204+ * Gets a specific interface constraint, if any.
205+ */
206+ deprecated Interface getAnInterfaceConstraint ( ) { result = getATypeConstraint ( ) }
208207
209- /** Gets a specific type parameter constraint, if any. */
210- TypeParameter getATypeParameterConstraint ( ) {
211- specific_type_parameter_constraints ( this , getTypeRef ( result ) )
212- }
208+ /**
209+ * DEPRECATED: Use `getATypeConstraint()` instead.
210+ * Gets a specific type parameter constraint, if any.
211+ */
212+ deprecated TypeParameter getATypeParameterConstraint ( ) { result = getATypeConstraint ( ) }
213213
214- /** Gets the specific class constraint, if any. */
215- Class getClassConstraint ( ) { specific_type_parameter_constraints ( this , getTypeRef ( result ) ) }
214+ /**
215+ * DEPRECATED: Use `getATypeConstraint()` instead.
216+ * Gets the specific class constraint, if any.
217+ */
218+ deprecated Class getClassConstraint ( ) { result = getATypeConstraint ( ) }
219+
220+ /** Gets a type constraint, if any. */
221+ Type getATypeConstraint ( ) { specific_type_parameter_constraints ( this , getTypeRef ( result ) ) }
216222
217223 /** Gets an annotated specific type constraint, if any. */
218- AnnotatedType getAnAnnotatedTypeConstraint ( ) {
219- result .appliesToTypeConstraint ( this )
220- }
224+ AnnotatedType getAnAnnotatedTypeConstraint ( ) { result .appliesToTypeConstraint ( this ) }
221225
222226 override Location getALocation ( ) { type_parameter_constraints_location ( this , result ) }
223227
@@ -366,8 +370,18 @@ class ConstructedType extends ValueOrRefType, ConstructedGeneric {
366370
367371 override UnboundGenericType getUnboundGeneric ( ) { constructed_generic ( this , getTypeRef ( result ) ) }
368372
373+ language [ monotonicAggregates]
374+ string annotatedTypeArgumentsToString ( ) {
375+ result = concat ( int i |
376+ exists ( this .getAnnotatedTypeArgument ( i ) )
377+ |
378+ this .getAnnotatedTypeArgument ( i ) .toString ( ) , ", " order by i
379+ )
380+ }
381+
369382 override string toStringWithTypes ( ) {
370- result = getUnboundGeneric ( ) .getNameWithoutBrackets ( ) + "<" + this .typeArgumentsToString ( ) + ">"
383+ result = getUnboundGeneric ( ) .getNameWithoutBrackets ( ) + "<" +
384+ this .annotatedTypeArgumentsToString ( ) + ">"
371385 }
372386
373387 final override Type getChild ( int n ) { result = getTypeArgument ( n ) }
0 commit comments