@@ -112,7 +112,7 @@ Set<BoolExpr> getTypeConstraints() {
112112 }
113113
114114 BoolExpr hasTruncation () {
115- return CelZ3TypeSystem .mkOrFlattened (ctx , truncationConditions );
115+ return CelZ3Exprs .mkOrFlattened (ctx , truncationConditions );
116116 }
117117
118118 CelZ3TypeSystem getTypeSystem () {
@@ -806,7 +806,7 @@ private FieldAccess getMapAccess(Expr<?> operand, String field, BoolExpr typeGua
806806 BoolExpr presence =
807807 (BoolExpr ) ctx .mkSelect ((ArrayExpr ) typeSystem .getMapPresence (mapRef ), mapFieldZ3Str );
808808 Expr <?> value = ctx .mkSelect ((ArrayExpr ) typeSystem .getMapValues (mapRef ), mapFieldZ3Str );
809- constrainPresentValue (CelZ3TypeSystem .mkAndFlattened (ctx , typeGuard , presence ), value );
809+ constrainPresentValue (CelZ3Exprs .mkAndFlattened (ctx , typeGuard , presence ), value );
810810 return new FieldAccess (presence , value );
811811 }
812812
@@ -816,7 +816,7 @@ private FieldAccess getMsgAccess(Expr<?> operand, String field, BoolExpr typeGua
816816 BoolExpr presence =
817817 (BoolExpr ) ctx .mkSelect ((ArrayExpr ) typeSystem .getMsgPresence (msgRef ), msgFieldZ3Str );
818818 Expr <?> value = ctx .mkSelect ((ArrayExpr ) typeSystem .getMsgValues (msgRef ), msgFieldZ3Str );
819- constrainPresentValue (CelZ3TypeSystem .mkAndFlattened (ctx , typeGuard , presence ), value );
819+ constrainPresentValue (CelZ3Exprs .mkAndFlattened (ctx , typeGuard , presence ), value );
820820 return new FieldAccess (presence , value );
821821 }
822822
@@ -853,7 +853,7 @@ private TranslatedValue translateSelect(CelExpr celExpr, CelAbstractSyntaxTree a
853853 FieldAccess msgAcc = getMsgAccess (operand , field , isMessage );
854854
855855 presenceResult =
856- CelZ3TypeSystem .SwitchBuilder .newBuilder (ctx )
856+ CelZ3Exprs .SwitchBuilder .newBuilder (ctx )
857857 .addCase (isMessage , msgAcc .presence )
858858 .addCase (isMap , mapAcc .presence )
859859 .build (ctx .mkFalse ());
@@ -863,7 +863,7 @@ private TranslatedValue translateSelect(CelExpr celExpr, CelAbstractSyntaxTree a
863863 Expr <?> mapRead = ctx .mkITE (mapAcc .presence , mapAcc .value , typeSystem .mkError ());
864864
865865 valueResult =
866- CelZ3TypeSystem .SwitchBuilder .newBuilder (ctx )
866+ CelZ3Exprs .SwitchBuilder .newBuilder (ctx )
867867 .addCase (isMessage , msgRead )
868868 .addCase (isMap , mapRead )
869869 .build (typeSystem .mkError ());
@@ -1060,7 +1060,7 @@ private TranslatedValue translateComprehension(CelExpr celExpr, CelAbstractSynta
10601060 TranslatedValue resultTv =
10611061 withScope (
10621062 comp .accuVar (),
1063- TranslatedValue .create (accu , typeSystem , CelZ3TypeSystem .mkOrFlattened (ctx , taints )),
1063+ TranslatedValue .create (accu , typeSystem , CelZ3Exprs .mkOrFlattened (ctx , taints )),
10641064 () -> translateExpr (comp .result (), ast ));
10651065 Expr <?> result = resultTv .z3Expr ();
10661066 return TranslatedValue .create (
@@ -1152,7 +1152,7 @@ private BoolExpr getBoundedMapBijection(
11521152 seqMap );
11531153 }
11541154 constraints .add (ctx .mkImplies (isNotTruncated , ctx .mkEq (mapPresence , seqMap )));
1155- return CelZ3TypeSystem .mkAndFlattened (ctx , constraints );
1155+ return CelZ3Exprs .mkAndFlattened (ctx , constraints );
11561156 }
11571157
11581158 private <T > T withIterationScope (
@@ -1301,8 +1301,7 @@ private TranslatedValue unrollMapAndFilter(
13011301 TranslatedValue resultTv =
13021302 withScope (
13031303 comp .accuVar (),
1304- TranslatedValue .create (
1305- chainedAccu , typeSystem , CelZ3TypeSystem .mkOrFlattened (ctx , taints )),
1304+ TranslatedValue .create (chainedAccu , typeSystem , CelZ3Exprs .mkOrFlattened (ctx , taints )),
13061305 () -> translateExpr (comp .result (), ast ));
13071306
13081307 Expr <?> iterRangeExpr = iterRangeTv .z3Expr ();
@@ -1313,10 +1312,10 @@ private TranslatedValue unrollMapAndFilter(
13131312 // result of any non-true condition, since the unrolled value ignores early exits.
13141313 BoolExpr isConditionUnmodeled = ctx .mkBool (!isLiteralTrue (comp .loopCondition ()));
13151314 BoolExpr isAbstracted =
1316- CelZ3TypeSystem .mkOrFlattened (ctx , rangeIsUnknown , isTruncated , isConditionUnmodeled );
1315+ CelZ3Exprs .mkOrFlattened (ctx , rangeIsUnknown , isTruncated , isConditionUnmodeled );
13171316 // An error is not final when truncated: an unknown from a later iteration overrides it.
13181317 Expr <?> finalResult =
1319- CelZ3TypeSystem .SwitchBuilder .newBuilder (ctx )
1318+ CelZ3Exprs .SwitchBuilder .newBuilder (ctx )
13201319 .addCase (rangeIsError , typeSystem .mkError ())
13211320 .addCase (isAbstracted , mkParameterizedUnknown (celExpr , ast ))
13221321 .build (resultTv .z3Expr ());
@@ -1326,7 +1325,7 @@ private TranslatedValue unrollMapAndFilter(
13261325 ctx .mkITE (
13271326 ctx .mkOr (rangeIsError , rangeIsUnknown ),
13281327 iterRangeTv .isApproximate (),
1329- CelZ3TypeSystem .mkOrFlattened (
1328+ CelZ3Exprs .mkOrFlattened (
13301329 ctx , resultTv .isApproximate (), isTruncated , isConditionUnmodeled ));
13311330
13321331 return TranslatedValue .create (finalResult , celExpr , typeSystem , finalTaint );
@@ -1379,50 +1378,49 @@ private TranslatedValue reduceAllOrExists(
13791378
13801379 BoolExpr isActive = iter .inBounds ;
13811380
1382- hasMatchList .add (CelZ3TypeSystem .mkAndFlattened (ctx , isActive , isMatch ));
1383- hasErrorList .add (CelZ3TypeSystem .mkAndFlattened (ctx , isActive , isE ));
1384- hasUnknownList .add (CelZ3TypeSystem .mkAndFlattened (ctx , isActive , isU ));
1381+ hasMatchList .add (CelZ3Exprs .mkAndFlattened (ctx , isActive , isMatch ));
1382+ hasErrorList .add (CelZ3Exprs .mkAndFlattened (ctx , isActive , isE ));
1383+ hasUnknownList .add (CelZ3Exprs .mkAndFlattened (ctx , isActive , isU ));
13851384
13861385 hasSafeMatchList .add (
1387- CelZ3TypeSystem .mkAndFlattened (
1388- ctx , isActive , isMatch , CelZ3TypeSystem .mkNotFlattened (ctx , stepTv .isApproximate ())));
1386+ CelZ3Exprs .mkAndFlattened (
1387+ ctx , isActive , isMatch , CelZ3Exprs .mkNotFlattened (ctx , stepTv .isApproximate ())));
13891388 hasSafeErrorList .add (
1390- CelZ3TypeSystem .mkAndFlattened (
1391- ctx , isActive , isE , CelZ3TypeSystem .mkNotFlattened (ctx , stepTv .isApproximate ())));
1389+ CelZ3Exprs .mkAndFlattened (
1390+ ctx , isActive , isE , CelZ3Exprs .mkNotFlattened (ctx , stepTv .isApproximate ())));
13921391 hasSafeUnknownList .add (
1393- CelZ3TypeSystem .mkAndFlattened (
1394- ctx , isActive , isU , CelZ3TypeSystem .mkNotFlattened (ctx , stepTv .isApproximate ())));
1395- activeTaints .add (CelZ3TypeSystem .mkAndFlattened (ctx , isActive , stepTv .isApproximate ()));
1392+ CelZ3Exprs .mkAndFlattened (
1393+ ctx , isActive , isU , CelZ3Exprs .mkNotFlattened (ctx , stepTv .isApproximate ())));
1394+ activeTaints .add (CelZ3Exprs .mkAndFlattened (ctx , isActive , stepTv .isApproximate ()));
13961395 }
13971396
1398- BoolExpr hasMatch = CelZ3TypeSystem .mkOrFlattened (ctx , hasMatchList );
1399- BoolExpr hasError = CelZ3TypeSystem .mkOrFlattened (ctx , hasErrorList );
1400- BoolExpr hasUnknown = CelZ3TypeSystem .mkOrFlattened (ctx , hasUnknownList );
1397+ BoolExpr hasMatch = CelZ3Exprs .mkOrFlattened (ctx , hasMatchList );
1398+ BoolExpr hasError = CelZ3Exprs .mkOrFlattened (ctx , hasErrorList );
1399+ BoolExpr hasUnknown = CelZ3Exprs .mkOrFlattened (ctx , hasUnknownList );
14011400 BoolExpr rangeIsError = typeSystem .isError (iterRangeTv .z3Expr ());
14021401 BoolExpr rangeIsUnknown = typeSystem .isUnknown (iterRangeTv .z3Expr ());
14031402
1404- BoolExpr hasSafeMatch = CelZ3TypeSystem .mkOrFlattened (ctx , hasSafeMatchList );
1405- BoolExpr hasSafeError = CelZ3TypeSystem .mkOrFlattened (ctx , hasSafeErrorList );
1406- BoolExpr hasSafeUnknown = CelZ3TypeSystem .mkOrFlattened (ctx , hasSafeUnknownList );
1407- BoolExpr anyActiveTaint = CelZ3TypeSystem .mkOrFlattened (ctx , activeTaints );
1403+ BoolExpr hasSafeMatch = CelZ3Exprs .mkOrFlattened (ctx , hasSafeMatchList );
1404+ BoolExpr hasSafeError = CelZ3Exprs .mkOrFlattened (ctx , hasSafeErrorList );
1405+ BoolExpr hasSafeUnknown = CelZ3Exprs .mkOrFlattened (ctx , hasSafeUnknownList );
1406+ BoolExpr anyActiveTaint = CelZ3Exprs .mkOrFlattened (ctx , activeTaints );
14081407
14091408 Expr <?> comprehensionUnknown = mkParameterizedUnknown (compExpr , ast );
14101409 Expr <?> result =
1411- CelZ3TypeSystem .SwitchBuilder .newBuilder (ctx )
1410+ CelZ3Exprs .SwitchBuilder .newBuilder (ctx )
14121411 .addCase (rangeIsError , typeSystem .mkError ())
14131412 .addCase (rangeIsUnknown , comprehensionUnknown )
14141413 .addCase (hasMatch , typeSystem .mkBool (!isAll ))
14151414 .addCase (ctx .mkOr (hasUnknown , isTruncated ), comprehensionUnknown )
14161415 .addCase (hasError , typeSystem .mkError ())
14171416 .build (typeSystem .mkBool (isAll ));
14181417
1419- BoolExpr baseTaint =
1420- CelZ3TypeSystem .mkOrFlattened (ctx , anyActiveTaint , iterRangeTv .isApproximate ());
1418+ BoolExpr baseTaint = CelZ3Exprs .mkOrFlattened (ctx , anyActiveTaint , iterRangeTv .isApproximate ());
14211419
14221420 // Taint identically shadows the value flow's short-circuit control structure
14231421 BoolExpr resultTaint =
14241422 (BoolExpr )
1425- CelZ3TypeSystem .SwitchBuilder .newBuilder (ctx )
1423+ CelZ3Exprs .SwitchBuilder .newBuilder (ctx )
14261424 .addCase (ctx .mkOr (rangeIsError , rangeIsUnknown ), iterRangeTv .isApproximate ())
14271425 .addCase (hasMatch , ctx .mkOr (iterRangeTv .isApproximate (), ctx .mkNot (hasSafeMatch )))
14281426 .addCase (
@@ -1562,7 +1560,7 @@ private BoolExpr createTypeConstraintForType(Expr<?> val, CelType type) {
15621560 boundsAndTypes .add (ctx .mkImplies (validIndex , elemConstraint ));
15631561 }
15641562
1565- return CelZ3TypeSystem .mkAndFlattened (ctx , boundsAndTypes );
1563+ return CelZ3Exprs .mkAndFlattened (ctx , boundsAndTypes );
15661564 }
15671565 if (type instanceof MapType ) {
15681566 // Do NOT emit a for-all quantifier over map keys or values here.
@@ -1614,7 +1612,7 @@ private BoolExpr createTypeConstraintForType(Expr<?> val, CelType type) {
16141612 boundsAndTypes .add (ctx .mkImplies (validEntry , createTypeConstraintForType (mapVal , valType )));
16151613 }
16161614
1617- return CelZ3TypeSystem .mkAndFlattened (ctx , boundsAndTypes );
1615+ return CelZ3Exprs .mkAndFlattened (ctx , boundsAndTypes );
16181616 }
16191617 if (type .kind () == CelKind .STRUCT ) {
16201618 return ctx .mkAnd (
0 commit comments