@@ -1448,11 +1448,21 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
14481448 private predicate compatibleContainer0 ( ApHeadContent apc , DataFlowType containerType ) {
14491449 exists ( DataFlowType containerType0 , Content c |
14501450 PrevStage:: storeStepCand ( _, _, c , _, _, containerType0 ) and
1451+ not isTopType ( containerType0 ) and
14511452 compatibleTypesCached ( containerType0 , containerType ) and
14521453 apc = projectToHeadContent ( c )
14531454 )
14541455 }
14551456
1457+ pragma [ nomagic]
1458+ private predicate topTypeContent ( ApHeadContent apc ) {
1459+ exists ( DataFlowType containerType0 , Content c |
1460+ PrevStage:: storeStepCand ( _, _, c , _, _, containerType0 ) and
1461+ isTopType ( containerType0 ) and
1462+ apc = projectToHeadContent ( c )
1463+ )
1464+ }
1465+
14561466 bindingset [ apc, containerType]
14571467 pragma [ inline_late]
14581468 private predicate compatibleContainer ( ApHeadContent apc , DataFlowType containerType ) {
@@ -1484,7 +1494,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
14841494 (
14851495 if castingNodeEx ( node )
14861496 then
1487- ap instanceof ApNil or compatibleContainer ( getHeadContent ( ap ) , node .getDataFlowType ( ) )
1497+ ap instanceof ApNil or
1498+ compatibleContainer ( getHeadContent ( ap ) , node .getDataFlowType ( ) ) or
1499+ topTypeContent ( getHeadContent ( ap ) )
14881500 else any ( )
14891501 )
14901502 }
0 commit comments