@@ -336,7 +336,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
336336 * ```
337337 * the type parameter `T` has the constraint `IComparable<T>`.
338338 */
339- Type getATypeParameterConstraint ( TypeParameter tp , TypePath path ) ;
339+ TypeMention getATypeParameterConstraint ( TypeParameter tp ) ;
340340
341341 /**
342342 * Holds if
@@ -1308,7 +1308,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13081308 private module AccessConstraint {
13091309 predicate relevantAccessConstraint (
13101310 Access a , AccessEnvironment e , Declaration target , AccessPosition apos , TypePath path ,
1311- Type constraint
1311+ TypeMention constraint
13121312 ) {
13131313 target = a .getTarget ( e ) and
13141314 typeParameterConstraintHasTypeParameter ( target , apos , path , constraint , _, _)
@@ -1336,7 +1336,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13361336 }
13371337
13381338 /** Gets the constraint that this relevant access should satisfy. */
1339- Type getConstraint ( Declaration target ) {
1339+ TypeMention getConstraint ( Declaration target ) {
13401340 relevantAccessConstraint ( a , e , target , apos , path , result )
13411341 }
13421342
@@ -1347,20 +1347,24 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13471347 Location getLocation ( ) { result = a .getLocation ( ) }
13481348 }
13491349
1350- private module SatisfiesConstraintInput implements SatisfiesTypeInputSig< RelevantAccess > {
1351- predicate relevantConstraint ( RelevantAccess at , Type constraint ) {
1350+ private module SatisfiesTypeParameterConstraintInput implements
1351+ SatisfiesConstraintInputSig< RelevantAccess , TypeMention >
1352+ {
1353+ predicate relevantConstraint ( RelevantAccess at , TypeMention constraint ) {
13521354 constraint = at .getConstraint ( _)
13531355 }
13541356 }
13551357
1358+ private module SatisfiesTypeParameterConstraint =
1359+ SatisfiesConstraint< RelevantAccess , TypeMention , SatisfiesTypeParameterConstraintInput > ;
1360+
13561361 predicate satisfiesConstraintType (
13571362 Access a , AccessEnvironment e , Declaration target , AccessPosition apos , TypePath prefix ,
1358- Type constraint , TypePath path , Type t
1363+ TypeMention constraint , TypePath path , Type t
13591364 ) {
13601365 exists ( RelevantAccess ra |
13611366 ra = MkRelevantAccess ( a , apos , e , prefix ) and
1362- SatisfiesType< RelevantAccess , SatisfiesConstraintInput > :: satisfiesConstraintType ( ra ,
1363- constraint , path , t ) and
1367+ SatisfiesTypeParameterConstraint:: satisfiesConstraintType ( ra , constraint , path , t ) and
13641368 constraint = ra .getConstraint ( target )
13651369 )
13661370 }
@@ -1469,17 +1473,17 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
14691473 */
14701474 pragma [ nomagic]
14711475 private predicate typeParameterConstraintHasTypeParameter (
1472- Declaration target , AccessPosition apos , TypePath pathToConstrained , Type constraint ,
1476+ Declaration target , AccessPosition apos , TypePath pathToConstrained , TypeMention constraint ,
14731477 TypePath pathToTp , TypeParameter tp
14741478 ) {
14751479 exists ( DeclarationPosition dpos , TypeParameter constrainedTp |
14761480 accessDeclarationPositionMatch ( apos , dpos ) and
14771481 constrainedTp = target .getTypeParameter ( _) and
1482+ constraint = getATypeParameterConstraint ( constrainedTp ) and
14781483 tp = target .getTypeParameter ( _) and
1479- tp = getATypeParameterConstraint ( constrainedTp , pathToTp ) and
1484+ tp = constraint . getTypeAt ( pathToTp ) and
14801485 constrainedTp != tp and
1481- constrainedTp = target .getDeclaredType ( dpos , pathToConstrained ) and
1482- constraint = getATypeParameterConstraint ( constrainedTp , TypePath:: nil ( ) )
1486+ constrainedTp = target .getDeclaredType ( dpos , pathToConstrained )
14831487 )
14841488 }
14851489
@@ -1488,7 +1492,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
14881492 Access a , AccessEnvironment e , Declaration target , TypePath path , Type t , TypeParameter tp
14891493 ) {
14901494 not exists ( getTypeArgument ( a , target , tp , _) ) and
1491- exists ( Type constraint , AccessPosition apos , TypePath pathToTp , TypePath pathToTp2 |
1495+ exists ( TypeMention constraint , AccessPosition apos , TypePath pathToTp , TypePath pathToTp2 |
14921496 typeParameterConstraintHasTypeParameter ( target , apos , pathToTp2 , constraint , pathToTp , tp ) and
14931497 AccessConstraint:: satisfiesConstraintType ( a , e , target , apos , pathToTp2 , constraint ,
14941498 pathToTp .appendInverse ( path ) , t )
0 commit comments