Repository navigation
Name generated values after what they are instead of #fresh - #477
Conversation
Path conditions, call results and other values the verifier introduces were all named #freshN, which tells a developer nothing. Each is now named after its origin: #if_condition, #loop_condition, #ternary_condition, #try_branch, #catch_branch, #<method>_result, #<field>_value, #new_<Class>, #operation_result, #array_length. The counter keeps the names unique, and characters the refinement language does not accept are replaced, so the names stay valid for the SMT encoding. Closes #373. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex review, round 1I found two issues and one test gap in the supplied diff. I did not run commands or tests.
|
A program variable named like a generated value (read_result) has instances #read_result_N, which the name pattern took for generated. Generated names now start with ##, which no instance name can, and the integration test fails on a missing or extra error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Round 1 responses:
Full suite locally: 694 tests, 0 failures. |
Codex review, round 2I’ll review the supplied diff and source for behavior changes and gaps in the new naming tests. I’ll keep findings to issues I can tie to specific lines; I won’t run commands.
|
|
Round 2 response:
Codex found no correctness bugs this round, so I'm ending the review loop here. No code changes in this round. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex review, round 3(Round 3 reviews 55fef6b, which renames the results of calls to methods with a contract.) I found no actionable correctness bug or remaining dependency on the old I could not verify compilation or test results because commands were unavailable. Codex had no findings this round, so nothing to fix or decline and the review loop ends here. It couldn't compile or run tests; locally the full suite passes at 55fef6b (687 tests, 0 failures). |
…lues (#483) Follow-up to #477 (refs #373). ## Problem The result of a call to a method with a contract was still named `#<method>_N`, so messages showed it like a program variable: `undoManager⁵⁵⁷ == getUndoManager⁵⁵⁵`. All other generated values got descriptive names in #477. ## Change `MethodsFunctionsChecker` names those results with `GeneratedNames.valueOf`, like the other generated values: `#<method>_result`, and `#new_<Class>` for a refined constructor. | Study exercise | Before | After | |---|---|---| | A1_56 JabRef `EditCommand.java:69` | `undoManager⁵⁵⁷ == getUndoManager⁵⁵⁵` | `undoManager⁵⁵⁷ == #getUndoManager_result⁵⁵⁵` | | A1_19 `AccessKeyGenerator.java:17` | `dceSecurityNameRandom(randomUUID³⁸¹)` | `dceSecurityNameRandom(#randomUUID_result³⁸¹)` | Checked on the four `exercises-oss` study workspaces: only generated names change; no error appears, disappears or moves. Nothing depends on the old format: state checks compare the stored return-variable name, hints use method names, and the simplification and counterexample code check only the `##` prefix. ## Tests - `TestGeneratedNames`: the three condition messages now read `#ready_result` instead of `ready`. - Full suite locally: 690 tests, 0 failures. Codex review on the change: no findings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Closes #373.
What changed
Every value the verifier introduces used to be called
#freshN, so path conditions, call results and new receivers all looked the same in Expected/Found and in counterexamples. The result of a call to a method with a contract was named#<method>_N, which was shown asgetUndoManager⁵⁵⁵, like a program variable. Each one is now named after where it comes from:ifcondition#if_condition¹¹while/forcondition (body and exit)#loop_condition¹⁴c ? a : bcondition#ternary_condition¹⁶#try_branch¹⁸,#catch_branch²¹#read_result²⁸(method name +_result)a.length, another object's field)#length_value⁷(field name +_value)new T(..).m()#new_Door³⁵x == null,instanceof, bitwise ops)#operation_result³⁰new int[n]#array_length⁴The subclass-contract checks in
AuxHierarchyRefinementsPassagealso used#freshfor the return value and the receiver. They now use the existing#ret_Nand#this_Nnames.How it works: the new
liquidjava.utils.GeneratedNamesbuilds every such name as##<description>_<counter>. The context counter keeps names unique. The second#keeps them apart from instances of program variables (#<variable>_<counter>), since a Java name can't start with#. Characters that the refinement language'sIDtoken doesn't accept (e.g.$inMap$Entry, non-ASCII letters in method names) are replaced by_, so the names still parse and work with the SMT encoding.GeneratedNames.isGeneratedreplaces the old#fresh_prefix checks in three places: the counterexample ordering (RefinementError), unused path-binder removal (VCBinderSimplification) and keeping condition values in context (RefinementTypeChecker). Nothing else matched the old call-result name#<method>_N: the return-value checks inAuxStateHandlercompare against theRETURN_VAR_NAMEmetadata, and the extension's translation table is keyed by whatever raw name the verifier sends.VariableFormatterremoves one#as it does for instances, so generated names are shown with a single#(#if_condition¹¹), as#freshwas, and stay distinct from program variables.Before / after
From the new fixture
testSuite/classes/generated_names_error:Study exercises (
exercises-oss, proposal C), run onmainand on this branch:Across the four study workspaces, only these generated names change in the messages; no error appears, disappears or moves.
The Found row in the issue's screenshot,
∀#fresh²²⁰ baseline²¹⁶ || extended²¹⁷, becomes∀#if_condition²²⁰ baseline²¹⁶ || extended²¹⁷.Tests
liquidjava-example/src/main/java/testSuite/classes/generated_names_error/(GeneratedNames.java,Door.java), one error for each origin that shows up in a message.TestGeneratedNames: one test checking the exact message for each of those errors (counters stripped); it fails on any missing or extra error.VariableFormatterTest,VCBinderSimplificationTest,VCConstraintSimplificationTest,RefinementErrorCounterexampleTestandTestCounterexamples.🤖 Generated with Claude Code