@@ -1070,7 +1070,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
10701070
10711071 /** An environment to track during type matching. */
10721072 bindingset [ this ]
1073- class Environment {
1073+ class AccessEnvironment {
10741074 /** Gets a textual representation of this environment. */
10751075 bindingset [ this ]
10761076 string toString ( ) ;
@@ -1101,10 +1101,10 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
11011101 * type at argument position `0` is `int`.
11021102 */
11031103 bindingset [ e]
1104- Type getInferredType ( Environment e , AccessPosition apos , TypePath path ) ;
1104+ Type getInferredType ( AccessEnvironment e , AccessPosition apos , TypePath path ) ;
11051105
11061106 /** Gets the declaration that this access targets in environment `e`. */
1107- Declaration getTarget ( Environment e ) ;
1107+ Declaration getTarget ( AccessEnvironment e ) ;
11081108 }
11091109
11101110 /** Holds if `apos` and `dpos` match. */
@@ -1151,7 +1151,8 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
11511151 */
11521152 pragma [ nomagic]
11531153 private predicate adjustedAccessType (
1154- Access a , Environment e , AccessPosition apos , Declaration target , TypePath path , Type t
1154+ Access a , AccessEnvironment e , AccessPosition apos , Declaration target , TypePath path ,
1155+ Type t
11551156 ) {
11561157 target = a .getTarget ( e ) and
11571158 exists ( TypePath path0 , Type t0 |
@@ -1184,7 +1185,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
11841185 */
11851186 pragma [ nomagic]
11861187 private predicate directTypeMatch (
1187- Access a , Environment e , Declaration target , TypePath path , Type t , TypeParameter tp
1188+ Access a , AccessEnvironment e , Declaration target , TypePath path , Type t , TypeParameter tp
11881189 ) {
11891190 not exists ( getTypeArgument ( a , target , tp , _) ) and
11901191 exists ( AccessPosition apos , DeclarationPosition dpos , TypePath pathToTypeParam |
@@ -1199,7 +1200,9 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
11991200 * Holds if inferring types at `a` in environment `e` might depend on the type at
12001201 * `path` of `apos` having `base` as a transitive base type.
12011202 */
1202- private predicate relevantAccess ( Access a , Environment e , AccessPosition apos , Type base ) {
1203+ private predicate relevantAccess (
1204+ Access a , AccessEnvironment e , AccessPosition apos , Type base
1205+ ) {
12031206 exists ( Declaration target , DeclarationPosition dpos |
12041207 adjustedAccessType ( a , e , apos , target , _, _) and
12051208 accessDeclarationPositionMatch ( apos , dpos ) and
@@ -1209,7 +1212,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
12091212
12101213 pragma [ nomagic]
12111214 private Type inferTypeAt (
1212- Access a , Environment e , AccessPosition apos , TypeParameter tp , TypePath suffix
1215+ Access a , AccessEnvironment e , AccessPosition apos , TypeParameter tp , TypePath suffix
12131216 ) {
12141217 relevantAccess ( a , e , apos , _) and
12151218 exists ( TypePath path0 |
@@ -1252,8 +1255,8 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
12521255 * `Base<C<T3>>` | `"T2.T1.T1"` | `int`
12531256 */
12541257 predicate hasBaseTypeMention (
1255- Access a , Environment e , AccessPosition apos , TypeMention baseMention , TypePath path ,
1256- Type t
1258+ Access a , AccessEnvironment e , AccessPosition apos , TypeMention baseMention ,
1259+ TypePath path , Type t
12571260 ) {
12581261 relevantAccess ( a , e , apos , resolveTypeMentionRoot ( baseMention ) ) and
12591262 exists ( Type sub | sub = a .getInferredType ( e , apos , TypePath:: nil ( ) ) |
@@ -1270,7 +1273,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
12701273
12711274 private module AccessConstraint {
12721275 predicate relevantAccessConstraint (
1273- Access a , Environment e , Declaration target , AccessPosition apos , TypePath path ,
1276+ Access a , AccessEnvironment e , Declaration target , AccessPosition apos , TypePath path ,
12741277 Type constraint
12751278 ) {
12761279 target = a .getTarget ( e ) and
@@ -1279,7 +1282,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
12791282
12801283 private newtype TRelevantAccess =
12811284 MkRelevantAccess (
1282- Access a , Environment e , Declaration target , AccessPosition apos , TypePath path
1285+ Access a , AccessEnvironment e , Declaration target , AccessPosition apos , TypePath path
12831286 ) {
12841287 relevantAccessConstraint ( a , e , target , apos , path , _)
12851288 }
@@ -1290,7 +1293,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
12901293 */
12911294 private class RelevantAccess extends MkRelevantAccess {
12921295 Access a ;
1293- Environment e ;
1296+ AccessEnvironment e ;
12941297 Declaration target ;
12951298 AccessPosition apos ;
12961299 TypePath path ;
@@ -1320,7 +1323,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13201323 }
13211324
13221325 predicate satisfiesConstraintType (
1323- Access a , Environment e , Declaration target , AccessPosition apos , TypePath prefix ,
1326+ Access a , AccessEnvironment e , Declaration target , AccessPosition apos , TypePath prefix ,
13241327 Type constraint , TypePath path , Type t
13251328 ) {
13261329 SatisfiesConstraint< RelevantAccess , SatisfiesConstraintInput > :: satisfiesConstraintType ( MkRelevantAccess ( a ,
@@ -1334,7 +1337,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13341337 */
13351338 pragma [ nomagic]
13361339 private predicate accessBaseType (
1337- Access a , Environment e , AccessPosition apos , Type base , TypePath path , Type t
1340+ Access a , AccessEnvironment e , AccessPosition apos , Type base , TypePath path , Type t
13381341 ) {
13391342 exists ( TypeMention tm |
13401343 AccessBaseType:: hasBaseTypeMention ( a , e , apos , tm , path , t ) and
@@ -1388,7 +1391,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13881391 */
13891392 pragma [ nomagic]
13901393 private predicate baseTypeMatch (
1391- Access a , Environment e , Declaration target , TypePath path , Type t , TypeParameter tp
1394+ Access a , AccessEnvironment e , Declaration target , TypePath path , Type t , TypeParameter tp
13921395 ) {
13931396 not exists ( getTypeArgument ( a , target , tp , _) ) and
13941397 target = a .getTarget ( e ) and
@@ -1406,7 +1409,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
14061409 */
14071410 pragma [ nomagic]
14081411 private predicate explicitTypeMatch (
1409- Access a , Environment e , Declaration target , TypePath path , Type t , TypeParameter tp
1412+ Access a , AccessEnvironment e , Declaration target , TypePath path , Type t , TypeParameter tp
14101413 ) {
14111414 target = a .getTarget ( e ) and
14121415 t = getTypeArgument ( a , target , tp , path )
@@ -1450,7 +1453,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
14501453
14511454 pragma [ nomagic]
14521455 private predicate typeConstraintBaseTypeMatch (
1453- Access a , Environment e , Declaration target , TypePath path , Type t , TypeParameter tp
1456+ Access a , AccessEnvironment e , Declaration target , TypePath path , Type t , TypeParameter tp
14541457 ) {
14551458 not exists ( getTypeArgument ( a , target , tp , _) ) and
14561459 exists ( Type constraint , AccessPosition apos , TypePath pathToTp , TypePath pathToTp2 |
@@ -1462,7 +1465,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
14621465
14631466 pragma [ inline]
14641467 private predicate typeMatch (
1465- Access a , Environment e , Declaration target , TypePath path , Type t , TypeParameter tp
1468+ Access a , AccessEnvironment e , Declaration target , TypePath path , Type t , TypeParameter tp
14661469 ) {
14671470 // A type given at the access corresponds directly to the type parameter
14681471 // at the target.
@@ -1517,7 +1520,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
15171520 * `"T2.T1.T1"` | `int`
15181521 */
15191522 pragma [ nomagic]
1520- Type inferAccessType ( Access a , Environment e , AccessPosition apos , TypePath path ) {
1523+ Type inferAccessType ( Access a , AccessEnvironment e , AccessPosition apos , TypePath path ) {
15211524 exists ( DeclarationPosition dpos | accessDeclarationPositionMatch ( apos , dpos ) |
15221525 // A suffix of `path` leads to a type parameter in the target
15231526 exists ( Declaration target , TypePath prefix , TypeParameter tp , TypePath suffix |
@@ -1653,17 +1656,17 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
16531656
16541657 predicate adjustAccessType = Input:: adjustAccessType / 6 ;
16551658
1656- class Environment = Unit ;
1659+ class AccessEnvironment = Unit ;
16571660
16581661 final private class AccessFinal = Input:: Access ;
16591662
16601663 class Access extends AccessFinal {
1661- Type getInferredType ( Environment e , AccessPosition apos , TypePath path ) {
1664+ Type getInferredType ( AccessEnvironment e , AccessPosition apos , TypePath path ) {
16621665 exists ( e ) and
16631666 result = super .getInferredType ( apos , path )
16641667 }
16651668
1666- Declaration getTarget ( Environment e ) {
1669+ Declaration getTarget ( AccessEnvironment e ) {
16671670 exists ( e ) and
16681671 result = super .getTarget ( )
16691672 }
0 commit comments