File tree Expand file tree Collapse file tree
main/java/de/uka/ilkd/key/java/transformations/pipeline
test/resources/testcase/loopScopeInvRule Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ public final class JMLTransformer extends JavaTransformer {
7373
7474 private static final Logger LOGGER = LoggerFactory .getLogger (JMLTransformer .class );
7575
76- private final JmlDocSanitizer sanitizer = new JmlDocSanitizer (Set .of ("key" ));
76+ private final JmlDocSanitizer sanitizer = new JmlDocSanitizer (
77+ ProofIndependentSettings .DEFAULT_INSTANCE .getGeneralSettings ().getJmlEnabledKeys ());
7778
7879 /// KEY for contracts
7980 public static final DataKey <List <TextualJMLConstruct >> KEY_SPEC_CASE = new DataKey <>() {
Original file line number Diff line number Diff line change 11public class Test {
2- /*@ public normal_behavior
3- @ requires i >= 0;
4- @ ensures (\result == 0 || \result <= -1) && ((flag && \old(i) < 17) ==> \result == -2) ;
5- @*/
6- public static int loopScopeRuleBenchmark (int i , boolean flag ) {
7- k : {
8- /*@ loop_invariant
9- @ i >= 0 && i <= \old(i);
10- @ decreases i;
11- @*/
12- l : while (i > 0 ) {
13- if (i == 17 ) {
14- i = 0 ;
15- continue l ; // have to prove the invariant
16- } else if (i == 42 ) {
17- i = -1 ;
18- break l ; // have to prove the postcondition!
19- } else if (i == 2048 ) {
20- i = -1 ;
21- break k ; // have to prove the postcondition
22- }
2+ /*@ public normal_behavior
3+ @ requires i >= 0;
4+ @ ensures (\result == 0 || \result <= -1) && ((flag && \old(i) < 17) ==> \result == -2) ;
5+ @*/
6+ public static int loopScopeRuleBenchmark (int i , boolean flag ) {
7+ k :
8+ {
9+ /*@ loop_invariant
10+ @ i >= 0 && i <= \old(i);
11+ @ decreases i;
12+ @*/
13+ l :
14+ while (i > 0 ) {
15+ if (i == 17 ) {
16+ i = 0 ;
17+ continue l ; // have to prove the invariant
18+ } else if (i == 42 ) {
19+ i = -1 ;
20+ break l ; // have to prove the postcondition!
21+ } else if (i == 2048 ) {
22+ i = -1 ;
23+ break k ; // have to prove the postcondition
24+ }
25+ i --;
26+ }
2327
24- i --;
25- }
28+ if (flag ) {
29+ i = -2 ;
30+ break k ;
31+ }
32+ }
2633
27- if (flag ) {
28- i = -2 ;
29- break k ;
30- }
34+ return i ;
3135 }
32-
33- return i ;
34- }
3536}
You can’t perform that action at this time.
0 commit comments