@@ -134,15 +134,11 @@ class TypePath = M1::TypePath;
134134
135135module TypePath = M1:: TypePath;
136136
137- private module Input2 implements InputSig2 {
138- private import TypeMention as TM
139-
140- class TypeMention = TM:: TypeMention ;
141-
137+ private module Input2 implements InputSig2< TypeMention > {
142138 TypeMention getABaseTypeMention ( Type t ) { none ( ) }
143139
144140 Type getATypeParameterConstraint ( TypeParameter tp , TypePath path ) {
145- exists ( TypeMention tm | result = tm .resolveTypeAt ( path ) |
141+ exists ( TypeMention tm | result = tm .getTypeAt ( path ) |
146142 tm = tp .( TypeParamTypeParameter ) .getTypeParam ( ) .getATypeBound ( ) .getTypeRepr ( ) or
147143 tm = tp .( SelfTypeParameter ) .getTrait ( ) or
148144 tm =
@@ -212,7 +208,7 @@ private module Input2 implements InputSig2 {
212208 }
213209}
214210
215- private module M2 = Make2< Input2 > ;
211+ private module M2 = Make2< TypeMention , Input2 > ;
216212
217213import M2
218214
@@ -231,7 +227,7 @@ module Consistency {
231227 // mention for the self type has multiple types for a path.
232228 not exists ( ImplItemNode impl , TypePath selfTypePath |
233229 n = impl .getAnAssocItem ( ) .( Function ) .getSelfParam ( ) and
234- strictcount ( impl .( Impl ) .getSelfTy ( ) .( TypeMention ) .resolveTypeAt ( selfTypePath ) ) > 1
230+ strictcount ( impl .( Impl ) .getSelfTy ( ) .( TypeMention ) .getTypeAt ( selfTypePath ) ) > 1
235231 )
236232 }
237233}
@@ -297,7 +293,7 @@ private class FunctionDeclaration extends Function {
297293 result = getAssocFunctionTypeAt ( this , i .asSome ( ) , pos , path )
298294 or
299295 i .isNone ( ) and
300- result = this .getParam ( pos .asPosition ( ) ) .getTypeRepr ( ) .( TypeMention ) .resolveTypeAt ( path )
296+ result = this .getParam ( pos .asPosition ( ) ) .getTypeRepr ( ) .( TypeMention ) .getTypeAt ( path )
301297 )
302298 }
303299
@@ -308,7 +304,7 @@ private class FunctionDeclaration extends Function {
308304 getAssocFunctionTypeAt ( this , i .asSome ( ) , any ( FunctionPosition pos | pos .isReturn ( ) ) , path )
309305 or
310306 i .isNone ( ) and
311- result = getReturnTypeMention ( this ) .resolveTypeAt ( path )
307+ result = getReturnTypeMention ( this ) .getTypeAt ( path )
312308 )
313309 }
314310
@@ -352,12 +348,12 @@ private TypeMention getCallExprTypeMentionArgument(CallExpr ce, TypeArgumentPosi
352348
353349pragma [ nomagic]
354350private Type getCallExprTypeArgument ( CallExpr ce , TypeArgumentPosition apos , TypePath path ) {
355- result = getCallExprTypeMentionArgument ( ce , apos ) .resolveTypeAt ( path )
351+ result = getCallExprTypeMentionArgument ( ce , apos ) .getTypeAt ( path )
356352 or
357353 // Handle constructions that use `Self(...)` syntax
358354 exists ( Path p , TypePath path0 |
359355 p = CallExprImpl:: getFunctionPath ( ce ) and
360- result = p .( TypeMention ) .resolveTypeAt ( path0 ) and
356+ result = p .( TypeMention ) .getTypeAt ( path0 ) and
361357 path0 .isCons ( TTypeParamTypeParameter ( apos .asTypeParam ( ) ) , path )
362358 )
363359}
@@ -380,16 +376,16 @@ private TypeMention getTypeAnnotation(AstNode n) {
380376/** Gets the type of `n`, which has an explicit type annotation. */
381377pragma [ nomagic]
382378private Type inferAnnotatedType ( AstNode n , TypePath path ) {
383- result = getTypeAnnotation ( n ) .resolveTypeAt ( path )
379+ result = getTypeAnnotation ( n ) .getTypeAt ( path )
384380 or
385- result = n .( ShorthandSelfParameterMention ) .resolveTypeAt ( path )
381+ result = n .( ShorthandSelfParameterMention ) .getTypeAt ( path )
386382}
387383
388384pragma [ nomagic]
389385private Type inferFunctionBodyType ( AstNode n , TypePath path ) {
390386 exists ( Function f |
391387 n = f .getFunctionBody ( ) and
392- result = getReturnTypeMention ( f ) .resolveTypeAt ( path ) and
388+ result = getReturnTypeMention ( f ) .getTypeAt ( path ) and
393389 not exists ( ImplTraitReturnType i | i .getFunction ( ) = f |
394390 result = i or result = i .getATypeParameter ( )
395391 )
@@ -433,7 +429,7 @@ module CertainTypeInference {
433429 private TypePath getPathToImplSelfTypeParam ( TypeParam tp ) {
434430 exists ( ImplItemNode impl |
435431 tp = impl .getTypeParam ( _) and
436- TTypeParamTypeParameter ( tp ) = impl .( Impl ) .getSelfTy ( ) .( TypeMention ) .resolveTypeAt ( result )
432+ TTypeParamTypeParameter ( tp ) = impl .( Impl ) .getSelfTy ( ) .( TypeMention ) .getTypeAt ( result )
437433 )
438434 }
439435
@@ -449,7 +445,7 @@ module CertainTypeInference {
449445 // and the path `Foo<i64>::bar` we must resolve `A` to `i64`.
450446 exists ( TypePath pathToTp |
451447 pathToTp = getPathToImplSelfTypeParam ( tp ) and
452- result = p .getQualifier ( ) .( TypeMention ) .resolveTypeAt ( pathToTp .appendInverse ( suffix ) )
448+ result = p .getQualifier ( ) .( TypeMention ) .getTypeAt ( pathToTp .appendInverse ( suffix ) )
453449 )
454450 or
455451 // For type parameters of the function we must resolve their
@@ -465,11 +461,11 @@ module CertainTypeInference {
465461 }
466462
467463 private Type inferCertainStructExprType ( StructExpr se , TypePath path ) {
468- result = se .getPath ( ) .( TypeMention ) .resolveTypeAt ( path )
464+ result = se .getPath ( ) .( TypeMention ) .getTypeAt ( path )
469465 }
470466
471467 private Type inferCertainStructPatType ( StructPat sp , TypePath path ) {
472- result = sp .getPath ( ) .( TypeMention ) .resolveTypeAt ( path )
468+ result = sp .getPath ( ) .( TypeMention ) .getTypeAt ( path )
473469 }
474470
475471 predicate certainTypeEquality ( AstNode n1 , TypePath prefix1 , AstNode n2 , TypePath prefix2 ) {
@@ -905,7 +901,7 @@ private module StructExprMatchingInput implements MatchingInputSig {
905901 // type of a field
906902 exists ( TypeMention tp |
907903 tp = this .getField ( dpos .asFieldPos ( ) ) .getTypeRepr ( ) and
908- result = tp .resolveTypeAt ( path )
904+ result = tp .getTypeAt ( path )
909905 )
910906 or
911907 // type parameter of the struct itself
@@ -958,7 +954,7 @@ private module StructExprMatchingInput implements MatchingInputSig {
958954 // Handle constructions that use `Self {...}` syntax
959955 exists ( TypeMention tm , TypePath path0 |
960956 tm = this .getStructPath ( ) and
961- result = tm .resolveTypeAt ( path0 ) and
957+ result = tm .getTypeAt ( path0 ) and
962958 path0 .isCons ( TTypeParamTypeParameter ( apos .asTypeParam ( ) ) , path )
963959 )
964960 }
@@ -1068,7 +1064,7 @@ pragma[nomagic]
10681064private Type getCallExprTypeQualifier ( CallExpr ce , TypePath path ) {
10691065 exists ( TypeMention tm |
10701066 tm = getCallExprPathQualifier ( ce ) and
1071- result = tm .resolveTypeAt ( path ) and
1067+ result = tm .getTypeAt ( path ) and
10721068 not resolvePath ( tm ) instanceof Trait
10731069 )
10741070}
@@ -2330,19 +2326,19 @@ private module MethodResolution {
23302326 * instance of the type being implemented.
23312327 */
23322328 private module TypeQualifierIsInstantiationOfImplSelfInput implements
2333- IsInstantiationOfInputSig< MethodCallCallExpr , TypeMentionTypeTree >
2329+ IsInstantiationOfInputSig< MethodCallCallExpr , TypeMention >
23342330 {
23352331 pragma [ nomagic]
23362332 private predicate potentialInstantiationOf0 (
2337- MethodCallCallExpr ce , ImplItemNode impl , TypeMentionTypeTree constraint
2333+ MethodCallCallExpr ce , ImplItemNode impl , TypeMention constraint
23382334 ) {
23392335 ce .hasTypeQualifiedCandidate ( impl ) and
23402336 constraint = impl .getSelfPath ( )
23412337 }
23422338
23432339 pragma [ nomagic]
23442340 predicate potentialInstantiationOf (
2345- MethodCallCallExpr ce , TypeAbstraction abs , TypeMentionTypeTree constraint
2341+ MethodCallCallExpr ce , TypeAbstraction abs , TypeMention constraint
23462342 ) {
23472343 potentialInstantiationOf0 ( ce , abs , constraint ) and
23482344 if abs .( Impl ) .hasTrait ( )
@@ -2353,14 +2349,13 @@ private module MethodResolution {
23532349 else any ( )
23542350 }
23552351
2356- predicate relevantConstraint ( TypeMentionTypeTree constraint ) {
2352+ predicate relevantConstraint ( TypeMention constraint ) {
23572353 potentialInstantiationOf0 ( _, _, constraint )
23582354 }
23592355 }
23602356
23612357 private module TypeQualifierIsInstantiationOfImplSelf =
2362- IsInstantiationOf< MethodCallCallExpr , TypeMentionTypeTree ,
2363- TypeQualifierIsInstantiationOfImplSelfInput > ;
2358+ IsInstantiationOf< MethodCallCallExpr , TypeMention , TypeQualifierIsInstantiationOfImplSelfInput > ;
23642359
23652360 /**
23662361 * A configuration for anti-matching the type of a receiver against the type of
@@ -2481,7 +2476,7 @@ private module MethodCallMatchingInput implements MatchingWithEnvironmentInputSi
24812476 .getGenericArgList ( )
24822477 .getTypeArg ( apos .asMethodTypeArgumentPosition ( ) )
24832478 .( TypeMention )
2484- .resolveTypeAt ( path )
2479+ .getTypeAt ( path )
24852480 or
24862481 result = getCallExprTypeArgument ( this , apos , path )
24872482 }
@@ -3012,7 +3007,7 @@ abstract private class TupleLikeConstructor extends Addressable {
30123007 }
30133008
30143009 Type getParameterType ( FunctionPosition pos , TypePath path ) {
3015- result = this .getTupleField ( pos .asPosition ( ) ) .getTypeRepr ( ) .( TypeMention ) .resolveTypeAt ( path )
3010+ result = this .getTupleField ( pos .asPosition ( ) ) .getTypeRepr ( ) .( TypeMention ) .getTypeAt ( path )
30163011 }
30173012}
30183013
@@ -3367,7 +3362,7 @@ private module FieldExprMatchingInput implements MatchingInputSig {
33673362 )
33683363 or
33693364 dpos .isField ( ) and
3370- result = this .getTypeRepr ( ) .( TypeMention ) .resolveTypeAt ( path )
3365+ result = this .getTypeRepr ( ) .( TypeMention ) .getTypeAt ( path )
33713366 }
33723367
33733368 override string toString ( ) { result = this .getAstNode ( ) .toString ( ) }
@@ -3719,7 +3714,7 @@ private module StructPatMatchingInput implements MatchingInputSig {
37193714 // The struct/enum type is supplied explicitly as a type qualifier, e.g.
37203715 // `let Foo<Bar>::Variant { ... } = ...`.
37213716 apos .isStructPos ( ) and
3722- result = this .getPath ( ) .( TypeMention ) .resolveTypeAt ( path )
3717+ result = this .getPath ( ) .( TypeMention ) .getTypeAt ( path )
37233718 }
37243719
37253720 Declaration getTarget ( ) { result = resolvePath ( this .getPath ( ) ) }
@@ -3769,7 +3764,7 @@ private module TupleStructPatMatchingInput implements MatchingInputSig {
37693764 // The struct/enum type is supplied explicitly as a type qualifier, e.g.
37703765 // `let Option::<Foo>::Some(x) = ...`.
37713766 apos .isSelf ( ) and
3772- result = this .getPath ( ) .( TypeMention ) .resolveTypeAt ( path )
3767+ result = this .getPath ( ) .( TypeMention ) .getTypeAt ( path )
37733768 }
37743769
37753770 Declaration getTarget ( ) { result = resolvePath ( this .getPath ( ) ) }
@@ -3958,13 +3953,13 @@ private Type inferClosureExprType(AstNode n, TypePath path) {
39583953 or
39593954 // Propagate return type annotation to body
39603955 n = ce .getClosureBody ( ) and
3961- result = ce .getRetType ( ) .getTypeRepr ( ) .( TypeMention ) .resolveTypeAt ( path )
3956+ result = ce .getRetType ( ) .getTypeRepr ( ) .( TypeMention ) .getTypeAt ( path )
39623957 )
39633958}
39643959
39653960pragma [ nomagic]
39663961private Type inferCastExprType ( CastExpr ce , TypePath path ) {
3967- result = ce .getTypeRepr ( ) .( TypeMention ) .resolveTypeAt ( path )
3962+ result = ce .getTypeRepr ( ) .( TypeMention ) .getTypeAt ( path )
39683963}
39693964
39703965cached
@@ -4162,7 +4157,7 @@ private module Debug {
41624157
41634158 predicate debugInferShorthandSelfType ( ShorthandSelfParameterMention self , TypePath path , Type t ) {
41644159 self = getRelevantLocatable ( ) and
4165- t = self .resolveTypeAt ( path )
4160+ t = self .getTypeAt ( path )
41664161 }
41674162
41684163 predicate debugInferMethodCallType ( AstNode n , TypePath path , Type t ) {
@@ -4177,7 +4172,7 @@ private module Debug {
41774172
41784173 predicate debugTypeMention ( TypeMention tm , TypePath path , Type type ) {
41794174 tm = getRelevantLocatable ( ) and
4180- tm .resolveTypeAt ( path ) = type
4175+ tm .getTypeAt ( path ) = type
41814176 }
41824177
41834178 Type debugInferAnnotatedType ( AstNode n , TypePath path ) {
0 commit comments