@@ -97,6 +97,9 @@ private module Input1 implements InputSig1<Location> {
9797 id = 2
9898 or
9999 kind = 1 and
100+ id = idOfTypeParameterAstNode ( tp0 .( DynTraitTypeParameter ) .getTypeParam ( ) )
101+ or
102+ kind = 2 and
100103 exists ( AstNode node | id = idOfTypeParameterAstNode ( node ) |
101104 node = tp0 .( TypeParamTypeParameter ) .getTypeParam ( ) or
102105 node = tp0 .( AssociatedTypeTypeParameter ) .getTypeAlias ( ) or
@@ -107,7 +110,7 @@ private module Input1 implements InputSig1<Location> {
107110 exists ( TupleTypeParameter ttp , int maxArity |
108111 maxArity = max ( int i | i = any ( TupleType tt ) .getArity ( ) ) and
109112 tp0 = ttp and
110- kind = 2 and
113+ kind = 3 and
111114 id = ttp .getTupleType ( ) .getArity ( ) * maxArity + ttp .getIndex ( )
112115 )
113116 |
@@ -189,6 +192,14 @@ private module Input2 implements InputSig2 {
189192 condition = impl and
190193 constraint = impl .getTypeBoundList ( ) .getABound ( ) .getTypeRepr ( )
191194 )
195+ or
196+ // a `dyn Trait` type implements `Trait`. See the comment on
197+ // `DynTypeBoundListMention` for further details.
198+ exists ( DynTraitTypeRepr object |
199+ abs = object and
200+ condition = object .getTypeBoundList ( ) and
201+ constraint = object .getTrait ( )
202+ )
192203 }
193204}
194205
@@ -1715,10 +1726,16 @@ private Function getMethodFromImpl(MethodCall mc) {
17151726
17161727bindingset [ trait, name]
17171728pragma [ inline_late]
1718- private Function getTraitMethod ( ImplTraitReturnType trait , string name ) {
1729+ private Function getImplTraitMethod ( ImplTraitReturnType trait , string name ) {
17191730 result = getMethodSuccessor ( trait .getImplTraitTypeRepr ( ) , name )
17201731}
17211732
1733+ bindingset [ traitObject, name]
1734+ pragma [ inline_late]
1735+ private Function getDynTraitMethod ( DynTraitType traitObject , string name ) {
1736+ result = getMethodSuccessor ( traitObject .getTrait ( ) , name )
1737+ }
1738+
17221739pragma [ nomagic]
17231740private Function resolveMethodCallTarget ( MethodCall mc ) {
17241741 // The method comes from an `impl` block targeting the type of the receiver.
@@ -1729,7 +1746,10 @@ private Function resolveMethodCallTarget(MethodCall mc) {
17291746 result = getTypeParameterMethod ( mc .getTypeAt ( TypePath:: nil ( ) ) , mc .getMethodName ( ) )
17301747 or
17311748 // The type of the receiver is an `impl Trait` type.
1732- result = getTraitMethod ( mc .getTypeAt ( TypePath:: nil ( ) ) , mc .getMethodName ( ) )
1749+ result = getImplTraitMethod ( mc .getTypeAt ( TypePath:: nil ( ) ) , mc .getMethodName ( ) )
1750+ or
1751+ // The type of the receiver is a trait object `dyn Trait` type.
1752+ result = getDynTraitMethod ( mc .getTypeAt ( TypePath:: nil ( ) ) , mc .getMethodName ( ) )
17331753}
17341754
17351755pragma [ nomagic]
@@ -2073,6 +2093,13 @@ private module Debug {
20732093 result = resolveCallTarget ( c )
20742094 }
20752095
2096+ predicate debugConditionSatisfiesConstraint (
2097+ TypeAbstraction abs , TypeMention condition , TypeMention constraint
2098+ ) {
2099+ abs = getRelevantLocatable ( ) and
2100+ Input2:: conditionSatisfiesConstraint ( abs , condition , constraint )
2101+ }
2102+
20762103 predicate debugInferImplicitSelfType ( SelfParam self , TypePath path , Type t ) {
20772104 self = getRelevantLocatable ( ) and
20782105 t = inferImplicitSelfType ( self , path )
0 commit comments