@@ -341,18 +341,14 @@ public void visitCtIf(CtIf ifElement) {
341341 CtExpression <Boolean > exp = ifElement .getCondition ();
342342 Predicate expRefs = getExpressionRefinements (exp );
343343
344- String pathVarName ;
344+ String pathVarName = String . format ( Formats . FRESH , context . getCounter ()) ;
345345 RefinedVariable freshRV ;
346346 if (isUninformativeCondition (expRefs , exp )) {
347- // No refinement means the condition is unknown, not true.
348- String conditionVarName = String .format (Formats .FRESH , context .getCounter ());
349- context .addInstanceToContext (conditionVarName , factory .Type ().BOOLEAN_PRIMITIVE , new Predicate (), exp );
350- expRefs = Predicate .createVar (conditionVarName );
351-
352- pathVarName = String .format (Formats .FRESH , context .getCounter ());
353- freshRV = context .addInstanceToContext (pathVarName , factory .Type ().BOOLEAN_PRIMITIVE , expRefs , exp );
347+ // No refinement means the condition is unknown, not true: model it as a fresh
348+ // boolean so the SMT solver may pick either truth value for each branch.
349+ expRefs = Predicate .createVar (pathVarName );
350+ freshRV = context .addInstanceToContext (pathVarName , factory .Type ().BOOLEAN_PRIMITIVE , new Predicate (), exp );
354351 } else {
355- pathVarName = String .format (Formats .FRESH , context .getCounter ());
356352 expRefs = expRefs .substituteVariable (Keys .WILDCARD , pathVarName );
357353 Predicate lastExpRefs = substituteAllVariablesForLastInstance (expRefs );
358354 expRefs = Predicate .createConjunction (expRefs , lastExpRefs );
@@ -382,8 +378,6 @@ public void visitCtIf(CtIf ifElement) {
382378
383379 // VISIT ELSE
384380 if (ifElement .getElseStatement () != null ) {
385- context .getVariableByName (pathVarName );
386- // expRefs = expRefs.negate();
387381 context .newRefinementToVariableInContext (pathVarName , expRefs .negate ());
388382
389383 context .enterContext ();
@@ -413,8 +407,14 @@ private boolean isUninformativeCondition(Predicate conditionRefinement, CtExpres
413407 }
414408
415409 /**
416- * Best-effort normal-completion check (JLS §14.21): branches that always {@code return} or {@code throw} cannot
417- * contribute state to code following the {@code if}, so their post-context must be discarded at the join.
410+ * Best-effort normal-completion check (JLS §14.21): branches that always {@code return}, {@code throw},
411+ * {@code break} or {@code continue} cannot contribute state to code following the {@code if}, so their post-context
412+ * must be discarded at the join.
413+ *
414+ * <p>
415+ * Not currently handled (treated conservatively as completing normally): {@code switch} where every case exits,
416+ * labeled {@code break}/{@code continue} targets, {@code try}/{@code catch}/{@code finally} flow, and infinite
417+ * loops such as {@code while (true)}. Extending this list only tightens precision.
418418 */
419419 private boolean canCompleteNormally (CtStatement statement ) {
420420 if (statement == null )
0 commit comments