Repository navigation
Use found … but expected … for refinement errors, drop the general hint, declare every from - #525
Merged
Merged
Conversation
…y entry state Refinement errors now use the same headline frame as state errors, found X but expected Y, instead of "X is not a subtype of Y". An empty found keeps "expected Y but could not prove it", without the general hint to add a refinement or condition, which pointed away from the fix. When a call has several @StateRefinement entry states, the declared-here excerpt marks every from that makes up expected, each with its where line. Each from is located in its own annotation, not at the first annotation that writes the same text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
Clean-code reviewI audited the diff with the clean-code-principles checklist. Fixed:
Declined:
|
Collaborator
Author
Codex review, round 1
|
A concatenated value falls back to the text search, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Round 1 reply: fixed. |
Collaborator
Author
Codex review, round 2No findings: "I found no actionable regressions in the diff. The focused declaration-position and diagnostic tests pass." The loop ends here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #520
Closes #521
What and why
X is not a subtype of Y, while state errors usefound X but expected Y. Refinement errors now usefound %s but expected %stoo (RefinementError). An empty Found keepsexpected Y but could not prove it.fromin declared-here (Drop the general UNKNOWN hint and show every from in declared-here #521, part 2). When Expected is the disjunction of several@StateRefinemententry states, the "Refinement declared here" excerpt marks everyfrom, and each one gets itswhere … means …line. Before,AuxStateHandlertook afindFirst().StateRefinementErrornow carries the list of declaration positions.LJDiagnostic.getDeclarationPositions()returns it, andgetDeclarationPosition()still returns the first one, so the IDE's Locations and State Machine are unchanged.fromwas found by its text in any LiquidJava annotation of the method. In A1_01, line 111'sfrom = "compressionTypeSet(this)"was placed at line 110'sto = "compressionTypeSet(this)".from/topositions now come from the annotation's own value, and the text search is only a fallback.Soundness: no message claims anything new. The excerpt and
wherelines quote the spec, and the Expected they explain is already the disjunction of these samefroms.Study tasks: before (main) → after
Each task still gives exactly one error, on its
reportedLine. A1_38, A1_56 and A1_09 are unchanged.A2_10
practice
practice2
A2_04: the headline is unchanged (
expected timeout >= 0 but could not prove it), and the hint block is gone:A1_01: declared-here, after:
Before, only line 110 was marked, and only its
whereline was shown.Tests
is not a subtype of(TestFoundBinders, TestStaticConstantNames, RefinementErrorCounterexampleTest).RefinementErrorCounterexampleTest.messageWithNothingFoundGivesNoHint: an empty Found gives no hint.TestDeclarationPositions.stateErrorPointsToEveryEntryStateWithWhatItMeanswith the new fixtureErrorStateRefinementEveryFrom.java, a named set with twofroms where the secondfromrepeats the first annotation'sto. It checks both positions and bothwherelines.mvn test: 731 tests, 0 failures.Study env: re-run after release (not edited here)
test/verify-tasks.py→test/out/verify-new.json: the practice, practice2 and A2_10 headlines, and the A2_04 hint.test/e2e.mjs):test/out/B-01…B-07-tour-step*.png(the tour runs on the practice file, whose headline changes).B-02-practice2-hover.png,B-11-practice2-hover.png,B-01/B-10-practice2-repair.png, and the block-1 practice equivalents.A-run2/A-03-A2_10-hover.png,A-run2/A-04-A2_10-liquidjava-view.png(headline).A-19-A2_04-hover.png,A-20-A2_04-liquidjava-view.png(hint removed).froms in the panel needs an extension change (it can readgetDeclarationPositions()).🤖 Generated with Claude Code