@@ -2859,7 +2859,10 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
28592859 Typ getTyp ( Type t ) { any ( ) }
28602860
28612861 bindingset [ c, tail]
2862- Ap apCons ( Content c , Ap tail ) { result .getAHead ( ) = c and exists ( tail ) }
2862+ Ap apCons ( Content c , Ap tail ) {
2863+ result .getAHead ( ) = c and
2864+ if result .isSingleton ( ) then tail instanceof ApNil else not tail instanceof ApNil
2865+ }
28632866
28642867 class ApHeadContent = ContentApprox ;
28652868
@@ -2961,7 +2964,10 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
29612964 Typ getTyp ( Type t ) { any ( ) }
29622965
29632966 bindingset [ c, tail]
2964- Ap apCons ( Content c , Ap tail ) { result .getHead ( ) = c and exists ( tail ) }
2967+ Ap apCons ( Content c , Ap tail ) {
2968+ result .getHead ( ) = c and
2969+ if result .isSingleton ( ) then tail instanceof ApNil else not tail instanceof ApNil
2970+ }
29652971
29662972 class ApHeadContent = Content ;
29672973
@@ -3077,7 +3083,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
30773083 not expensiveLen2unfolding ( c )
30783084 } or
30793085 TConsCons ( Content c1 , Content c2 , int len ) {
3080- Stage4:: consCand ( c1 , TFrontHead ( c2 ) ) and
3086+ Stage4:: consCand ( c1 , TFrontHead ( c2 , _ ) ) and
30813087 len in [ 2 .. Config:: accessPathLimit ( ) ] and
30823088 not expensiveLen2unfolding ( c1 )
30833089 } or
@@ -3131,7 +3137,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
31313137
31323138 override int len ( ) { result = 1 }
31333139
3134- override AccessPathFront getFront ( ) { result = TFrontHead ( c ) }
3140+ override AccessPathFront getFront ( ) { result = TFrontHead ( c , true ) }
31353141
31363142 override predicate isCons ( Content head , AccessPathApprox tail ) { head = c and tail = TNil ( ) }
31373143 }
@@ -3153,7 +3159,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
31533159
31543160 override int len ( ) { result = len }
31553161
3156- override AccessPathFront getFront ( ) { result = TFrontHead ( c1 ) }
3162+ override AccessPathFront getFront ( ) { result = TFrontHead ( c1 , false ) }
31573163
31583164 override predicate isCons ( Content head , AccessPathApprox tail ) {
31593165 head = c1 and
@@ -3184,12 +3190,14 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
31843190
31853191 override int len ( ) { result = len }
31863192
3187- override AccessPathFront getFront ( ) { result = TFrontHead ( c ) }
3193+ override AccessPathFront getFront ( ) {
3194+ if len = 1 then result = TFrontHead ( c , true ) else result = TFrontHead ( c , false )
3195+ }
31883196
31893197 override predicate isCons ( Content head , AccessPathApprox tail ) {
31903198 head = c and
31913199 (
3192- exists ( Content c2 | Stage4:: consCand ( c , TFrontHead ( c2 ) ) |
3200+ exists ( Content c2 | Stage4:: consCand ( c , TFrontHead ( c2 , _ ) ) |
31933201 tail = TConsCons ( c2 , _, len - 1 )
31943202 or
31953203 len = 2 and
@@ -3531,7 +3539,11 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
35313539
35323540 override predicate isCons ( Content head , AccessPath tail ) { head = head_ and tail = tail_ }
35333541
3534- override AccessPathFrontHead getFront ( ) { result = TFrontHead ( head_ ) }
3542+ override AccessPathFrontHead getFront ( ) {
3543+ if tail_ .length ( ) = 0
3544+ then result = TFrontHead ( head_ , true )
3545+ else result = TFrontHead ( head_ , false )
3546+ }
35353547
35363548 override AccessPathApproxCons getApprox ( ) {
35373549 result = TConsNil ( head_ ) and tail_ = TAccessPathNil ( )
@@ -3586,7 +3598,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
35863598 tail .length ( ) = len - 1
35873599 }
35883600
3589- override AccessPathFrontHead getFront ( ) { result = TFrontHead ( head1 ) }
3601+ override AccessPathFrontHead getFront ( ) { result = TFrontHead ( head1 , false ) }
35903602
35913603 override AccessPathApproxCons getApprox ( ) {
35923604 result = TConsCons ( head1 , head2 , len ) or
@@ -3618,7 +3630,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
36183630 tail .length ( ) = len - 1
36193631 }
36203632
3621- override AccessPathFrontHead getFront ( ) { result = TFrontHead ( head_ ) }
3633+ override AccessPathFrontHead getFront ( ) {
3634+ if len = 1 then result = TFrontHead ( head_ , true ) else result = TFrontHead ( head_ , false )
3635+ }
36223636
36233637 override AccessPathApproxCons getApprox ( ) { result = TCons1 ( head_ , len ) }
36243638
0 commit comments