@@ -742,6 +742,9 @@ private enum IsAlwaysTrueTestCase {
742742 OPTIONAL_VALUE_VAR ("optional.of(x).value() == x" ),
743743 OPTIONAL_HAS_VALUE_VAR ("optional.of(x).hasValue()" ),
744744 OPTIONAL_VAR_HAS_VALUE_IMPLIES_INT ("opt_var.hasValue() ? type(opt_var.value()) == int : true" ),
745+ OPTIONAL_LIST_INDEX ("size(int_list) > 0 ? int_list[?0].value() == int_list[0] : true" ),
746+ OPTIONAL_MAP_INDEX (
747+ "'a' in string_int_map ? string_int_map[?'a'].value() == string_int_map['a'] : true" ),
745748
746749 IEEE_754_PROTO_NEG_ZERO_NEQ (
747750 "TestAllTypes{single_double: -0.0} != TestAllTypes{single_double: 0.0}" ),
@@ -978,6 +981,7 @@ private enum IsAlwaysTrueTestCase {
978981 "size(int_list) > 15 ? type(int_list[dyn(15)]) == int : true" ),
979982 MAP_INDEX_TYPE_CONSTRAINT (
980983 "'key' in string_int_map ? type(string_int_map['key']) == int : true" ),
984+ FIELD_SELECTION_TYPE_CONSTRAINT ("type(test_all_types.single_int64) == int" ),
981985 LITERAL_LIST_INDEX ("[1, 2][0] == 1" ),
982986 NESTED_LIST_VARIABLES_EQUALITY (
983987 "nested_list == [[1]] && nested_list_2 == [[1]] ? nested_list == nested_list_2 : true" ),
@@ -1045,6 +1049,7 @@ public void isAlwaysTrue_withUnknownIdentifier_evaluatesToUnknown(
10451049 "x == x" ,
10461050 "[x] == [x]" ,
10471051 "{1: x} == {1: x}" ,
1052+ "size(int_list) == 1 ? int_list.all(i, x == x) : true" ,
10481053 })
10491054 String expression )
10501055 throws Exception {
@@ -1569,6 +1574,12 @@ private enum IsAlwaysTrueViolationTestCase {
15691574 "[true, 1/0].exists(x, x) == true" ,
15701575 "Condition is not always true\\ ." ,
15711576 "\\ (The expression fails unconditionally, regardless of input state\\ )" ),
1577+ // The non-negative element can't make the step false, so only an error at 0 violates it.
1578+ DYNAMIC_LIST_ALL_STEP_ERROR_PROPAGATES (
1579+ "size(int_list) == 1 && int_list[0] >= 0 ? int_list.all(x, 10 / x >= 0) : true" ,
1580+ "Condition is not always true\\ ." ,
1581+ "Counterexample input:" ,
1582+ "int_list = \\ [0\\ ]" ),
15721583 DYNAMIC_STRING_MACRO_TYPE_MISMATCH (
15731584 "unknown_var == 1 ? !(unknown_var.contains('a') == true || unknown_var.contains('a') =="
15741585 + " false) : true" ,
0 commit comments