@@ -23,19 +23,19 @@ private import dotnet
2323 */
2424class Generic extends DotNet:: Generic , Declaration , @generic {
2525 Generic ( ) {
26- is_generic ( this ) or
27- is_constructed ( this )
26+ type_parameters ( _ , _ , this , _ ) or
27+ type_arguments ( _ , _ , this )
2828 }
2929}
3030
3131/**
32- * A generic declaration that can have type parameters.
32+ * A generic declaration with type parameters.
3333 *
3434 * Either an unbound generic type (`UnboundGenericType`) or an unbound generic method
3535 * (`UnboundGenericMethod`).
3636 */
3737class UnboundGeneric extends DotNet:: UnboundGeneric , Generic {
38- UnboundGeneric ( ) { is_generic ( this ) }
38+ UnboundGeneric ( ) { type_parameters ( _ , _ , this , _ ) }
3939
4040 override TypeParameter getTypeParameter ( int n ) { type_parameters ( result , n , this , _) }
4141
@@ -47,24 +47,21 @@ class UnboundGeneric extends DotNet::UnboundGeneric, Generic {
4747}
4848
4949/**
50- * A declaration constructed from an `UnboundGeneric` by supplying type arguments .
50+ * A constructed generic .
5151 *
5252 * Either a constructed generic type (`ConstructedType`) or a constructed
5353 * generic method (`ConstructedMethod`).
5454 */
5555class ConstructedGeneric extends DotNet:: ConstructedGeneric , Generic {
56- ConstructedGeneric ( ) { is_constructed ( this ) }
56+ ConstructedGeneric ( ) { type_arguments ( _ , _ , this ) }
5757
5858 override UnboundGeneric getUnboundGeneric ( ) { constructed_generic ( this , result ) }
5959
6060 override UnboundGeneric getSourceDeclaration ( ) {
6161 result = getUnboundGeneric ( ) .getSourceDeclaration ( )
6262 }
6363
64- override int getNumberOfTypeArguments ( ) {
65- // getTypeArgument() could fail if the type does not exist in the database
66- result = count ( int i | type_arguments ( _, i , this ) )
67- }
64+ override int getNumberOfTypeArguments ( ) { result = count ( int i | type_arguments ( _, i , this ) ) }
6865
6966 override Type getTypeArgument ( int i ) { none ( ) }
7067
@@ -84,11 +81,12 @@ class ConstructedGeneric extends DotNet::ConstructedGeneric, Generic {
8481 */
8582class UnboundGenericType extends ValueOrRefType , UnboundGeneric {
8683 /**
87- * Gets a bound/constructed version of this unbound generic type. This includes not only closed constructed types such as `G<int>`,
88- * but also open constructed types such as the `G<T>` in `class Other<T> { G<T> g; }`. Note that such a type is distinct from the
89- * `G<T>` used in the class definition, since in `G<T> g;` the `T` will be the actual type parameter used for the `Other` that contains
90- * `g`, whereas in `class G<T> { ... }` the `T` is a formal type parameter of `G`. It is important not to get confused by the superficial
91- * syntactic similarity.
84+ * Gets a bound/constructed version of this unbound generic type. This includes
85+ * not only closed constructed types such as `G<int>`, but also open constructed
86+ * types such as the `G<T>` in `class Other<T> { G<T> g; }`. Note that such a type
87+ * is distinct from the `G<T>` used in the class definition, since in `G<T> g;`
88+ * the `T` will be the actual type parameter used for the `Other` that contains
89+ * `g`, whereas in `class G<T> { ... }` the `T` is a formal type parameter of `G`.
9290 */
9391 override ConstructedType getAConstructedGeneric ( ) {
9492 result = UnboundGeneric .super .getAConstructedGeneric ( )
@@ -350,15 +348,16 @@ class UnboundGenericDelegateType extends DelegateType, UnboundGenericType {
350348}
351349
352350/**
353- * A constructed (bound) type. This is a generic type for which actual type arguments have been supplied,
354- * for example `G<int>` or the `G<T>` in `class Other<T> { G<T> g; }`. Constructed types can be divided further into
355- * those that are open (for example `G1<T>` or `G2<T,T,U,int>`), in the sense that one or more of their type arguments
356- * is a type parameter, versus those that are closed (for example `G1<int>` or `G2<long,long,float,int>`). We do not
357- * currently distinguish the two in this library.
358- *
359- * Either a constructed `struct` (`ConstructedStruct`), constructed `class` (`ConstructedClass`),
360- * constructed `interface` (`ConstructedInterface`), or constructed method
361- * (`ConstructedMethod`).
351+ * A constructed (bound) type. This is a generic type for which actual type
352+ * arguments have been supplied, for example `G<int>` or the `G<T>` in
353+ * `class Other<T> { G<T> g; }`. Constructed types can be divided further into
354+ * those that are open (for example `G1<T>` or `G2<T,T,U,int>`), in the sense
355+ * that one or more of their type arguments is a type parameter, versus those
356+ * that are closed (for example `G1<int>` or `G2<long,long,float,int>`).
357+ *
358+ * Either a constructed `struct` (`ConstructedStruct`), constructed `class`
359+ * (`ConstructedClass`), constructed `interface` (`ConstructedInterface`),
360+ * or constructed method (`ConstructedMethod`).
362361 */
363362class ConstructedType extends ValueOrRefType , ConstructedGeneric {
364363 override UnboundGenericType getSourceDeclaration ( ) {
0 commit comments