You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 80bdd78
Browse filesBrowse the repository at this point in the historyBrowse files
Check current receiver typestate across loops (#384)
A state change inside a loop must not establish the receiver state after
a loop that can run zero times. Main already havocs local receivers, but
calls on explicit and implicit `this` skipped receiver state checking
entirely. For example, `while (n > 0) { this.mark(); n--; }
this.reset();` incorrectly passed.
Initialize each instance method's receiver from its declared entry
states, resolve current `this` and unqualified `super` through the same
receiver predicate, and include that receiver in loop havoc. Qualified
outer receivers retain their existing handling. State-preserving methods
with multiple entry alternatives check the union of those preconditions,
so a wrapper accepting either state can call another method accepting
either state.
Add passing and failing regressions for local receivers in
while/for/foreach loops, explicit and implicit `this`, later iterations,
direct receiver calls, unconditional transitions after loops, and
multiple state-preserving entry alternatives.
Validation: `mvn -pl liquidjava-verifier test` — 389 tests, zero
failures or errors.
Precision remains conservative: loops forget changed receiver state, and
methods with alternative transitions that change state still require one
applicable alternative to be provable. This change does not initialize
constructor receivers or expand instance methods named `main`.
Closes#338.
Copy file name to clipboardExpand all lines: liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/general_checkers/MethodsFunctionsChecker.java
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@
19
19
importliquidjava.utils.Utils;
20
20
importliquidjava.utils.constants.Formats;
21
21
importliquidjava.utils.constants.Keys;
22
+
importliquidjava.utils.constants.Types;
22
23
importspoon.reflect.code.CtConstructorCall;
23
24
importspoon.reflect.code.CtExpression;
24
25
importspoon.reflect.code.CtFieldRead;
@@ -446,6 +447,19 @@ public void loadFunctionInfo(CtExecutable<?> method) {
446
447
for (Variablev : lv)
447
448
rtc.getContext().addVarToContext(v);
448
449
}
450
+
if (methodinstanceofCtMethod<?> instanceMethod && !instanceMethod.isStatic()) {
451
+
// The contract describes the entry state, not an invariant of every intermediate receiver state.
Copy file name to clipboardExpand all lines: liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/object_checkers/AuxStateHandler.java
0 commit comments