@@ -28,11 +28,16 @@ module Impl {
28
28
/** Gets the position of this type parameter. */
29
29
int getPosition ( ) { this = any ( GenericParamList l ) .getTypeParam ( result ) }
30
30
31
- private int nrOfDirectTypeBounds ( ) {
32
- result = this .getTypeBoundList ( ) .getNumberOfBounds ( )
33
- or
34
- not this .hasTypeBoundList ( ) and
35
- result = 0
31
+ private TypeBound getTypeBoundAt ( int i , int j ) {
32
+ exists ( TypeBoundList tbl | result = tbl .getBound ( j ) |
33
+ tbl = this .getTypeBoundList ( ) and i = 0
34
+ or
35
+ exists ( WherePred wp |
36
+ wp = this .( TypeParamItemNode ) .getAWherePred ( ) and
37
+ tbl = wp .getTypeBoundList ( ) and
38
+ wp = any ( WhereClause wc ) .getPredicate ( i )
39
+ )
40
+ )
36
41
}
37
42
38
43
/**
@@ -42,12 +47,7 @@ module Impl {
42
47
* any `where` clauses for this type parameter.
43
48
*/
44
49
TypeBound getTypeBound ( int index ) {
45
- exists ( TypeBoundList tbl , int offset | result = tbl .getBound ( index - offset ) |
46
- tbl = this .getTypeBoundList ( ) and offset = 0
47
- or
48
- tbl = this .( TypeParamItemNode ) .getAWherePred ( ) .getTypeBoundList ( ) and
49
- offset = this .nrOfDirectTypeBounds ( )
50
- )
50
+ result = rank [ index + 1 ] ( int i , int j | | this .getTypeBoundAt ( i , j ) order by i , j )
51
51
}
52
52
53
53
/**
@@ -56,7 +56,12 @@ module Impl {
56
56
* This includes type bounds directly on this type parameter and bounds from
57
57
* any `where` clauses for this type parameter.
58
58
*/
59
- TypeBound getATypeBound ( ) { result = this .getTypeBound ( _) }
59
+ TypeBound getATypeBound ( ) {
60
+ // NOTE: This predicate is used in path resolution, so it can not be
61
+ // defined using `getTypeBound` as that would cause non-monotonic
62
+ // recursion due to the `rank`.
63
+ result = this .getTypeBoundAt ( _, _)
64
+ }
60
65
61
66
override string toAbbreviatedString ( ) { result = this .getName ( ) .getText ( ) }
62
67
0 commit comments