@@ -29,18 +29,20 @@ class FunctionPosition extends TFunctionPosition {
2929
3030 predicate isReturn ( ) { this = TReturnFunctionPosition ( ) }
3131
32+ /** Gets the corresponding position when function call syntax is used. */
33+ FunctionPosition getFunctionCallAdjusted ( ) {
34+ ( this .isReturn ( ) or this .isTypeQualifier ( ) ) and
35+ result = this
36+ or
37+ this .isSelf ( ) and result .asPosition ( ) = 0
38+ or
39+ result .asPosition ( ) = this .asPosition ( ) + 1
40+ }
41+
3242 /** Gets the corresponding position when `f` is invoked via a function call. */
3343 bindingset [ f]
3444 FunctionPosition getFunctionCallAdjusted ( Function f ) {
35- this .isReturn ( ) and
36- result = this
37- or
38- if f .hasSelfParam ( )
39- then
40- this .isSelf ( ) and result .asPosition ( ) = 0
41- or
42- result .asPosition ( ) = this .asPosition ( ) + 1
43- else result = this
45+ if f .hasSelfParam ( ) then result = this .getFunctionCallAdjusted ( ) else result = this
4446 }
4547
4648 TypeMention getTypeMention ( Function f ) {
@@ -197,7 +199,7 @@ class AssocFunctionType extends MkAssocFunctionType {
197199 exists ( Function f , ImplOrTraitItemNode i , FunctionPosition pos | this .appliesTo ( f , i , pos ) |
198200 result = pos .getTypeMention ( f )
199201 or
200- pos .isSelf ( ) and
202+ pos .isSelfOrTypeQualifier ( ) and
201203 not f .hasSelfParam ( ) and
202204 result = [ i .( Impl ) .getSelfTy ( ) .( AstNode ) , i .( Trait ) .getName ( ) ]
203205 )
@@ -209,7 +211,7 @@ class AssocFunctionType extends MkAssocFunctionType {
209211}
210212
211213pragma [ nomagic]
212- private Trait getALookupTrait ( Type t ) {
214+ Trait getALookupTrait ( Type t ) {
213215 result = t .( TypeParamTypeParameter ) .getTypeParam ( ) .( TypeParamItemNode ) .resolveABound ( )
214216 or
215217 result = t .( SelfTypeParameter ) .getTrait ( )
0 commit comments