File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,14 @@ module Impl {
23
23
* ```
24
24
*/
25
25
class ImplTraitTypeRepr extends Generated:: ImplTraitTypeRepr {
26
- /**
27
- * Gets the function for which this impl trait type occurs in the return
28
- * type, if any.
29
- */
30
- Function getFunctionReturnPos ( ) { this .getParentNode * ( ) = result .getRetType ( ) .getTypeRepr ( ) }
26
+ /** Gets the function for which this impl trait type occurs, if any. */
27
+ Function getFunction ( ) {
28
+ this .getParentNode * ( ) = [ result .getRetType ( ) .getTypeRepr ( ) , result .getAParam ( ) .getTypeRepr ( ) ]
29
+ }
30
+
31
+ /** Holds if this impl trait type occurs in the return type of a function. */
32
+ predicate isInReturnPos ( ) {
33
+ this .getParentNode * ( ) = this .getFunction ( ) .getRetType ( ) .getTypeRepr ( )
34
+ }
31
35
}
32
36
}
Original file line number Diff line number Diff line change @@ -60,7 +60,8 @@ newtype TType =
60
60
TSliceTypeParameter ( )
61
61
62
62
predicate implTraitTypeParam ( ImplTraitTypeRepr implTrait , int i , TypeParam tp ) {
63
- tp = implTrait .getFunctionReturnPos ( ) .getGenericParamList ( ) .getTypeParam ( i ) and
63
+ implTrait .isInReturnPos ( ) and
64
+ tp = implTrait .getFunction ( ) .getGenericParamList ( ) .getTypeParam ( i ) and
64
65
// Only include type parameters of the function that occur inside the impl
65
66
// trait type.
66
67
exists ( Path path | path .getParentNode * ( ) = implTrait and resolvePath ( path ) = tp )
@@ -317,7 +318,7 @@ class DynTraitType extends Type, TDynTraitType {
317
318
class ImplTraitReturnType extends ImplTraitType {
318
319
private Function function ;
319
320
320
- ImplTraitReturnType ( ) { function = impl .getFunctionReturnPos ( ) }
321
+ ImplTraitReturnType ( ) { impl . isInReturnPos ( ) and function = impl .getFunction ( ) }
321
322
322
323
override Function getFunction ( ) { result = function }
323
324
}
You can’t perform that action at this time.
0 commit comments