Extract Assert for the Solver/Optimize dispatch - #108
Draft
HowardvanRooijen wants to merge 1 commit into
Draft
Conversation
A theorem is checked with either a Solver or an Optimize, held as a Z3Object, and both AssertConstraints and AssertBounds switched on which one to call the matching Assert. That identical block now lives in one private helper, so adding a term to assert reads as `Assert(approach, term)` and the Solver-or-Optimize dispatch has a single home. The other per-approach operations (Check, ReasonUnknown, applying the limits) are distinct and stay where they are - two of them are already switch expressions. Pure extraction: 322 tests unchanged, allocation cannot change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PipoHZJsgydrV3JC3fQN6Q
Test Results 1 files 1 suites 11s ⏱️ Results for commit be8044f. |
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.
Second of the three flagged dedup refactors. A theorem is checked with either a
Solveror anOptimize, carried as aZ3Object, and bothAssertConstraintsandAssertBoundsheld the sameswitch (approach) { case Solver: solver.Assert(x); case Optimize: optimize.Assert(x); }block toadd a term. That block now lives in one private
Assert(Z3Object, BoolExpr)helper, so asserting aterm reads as
Assert(approach, term)and the Solver-or-Optimize dispatch for asserting has a singlehome.
The other per-approach operations are distinct and stay where they are:
Check()andReasonUnknownare already concise
switchexpressions, and applying the limits is a different operation (it sets aproperty, under a guard).
Pure extraction - no behaviour change, no allocation change.
Verified
dotnet build solutions/Z3.Linq.slnx -c Release- clean../build.ps1 -Configuration Release- 46 tasks, 0 errors, 0 warnings.No public-API or behaviour change. Releases remain on hold under #60 regardless.
🤖 Generated with Claude Code