Skip to content

Extract Assert for the Solver/Optimize dispatch - #108

Draft
HowardvanRooijen wants to merge 1 commit into
feature/member-clr-type-helperfrom
feature/assert-dispatch-helper
Draft

Extract Assert for the Solver/Optimize dispatch#108
HowardvanRooijen wants to merge 1 commit into
feature/member-clr-type-helperfrom
feature/assert-dispatch-helper

Conversation

@HowardvanRooijen

@HowardvanRooijen HowardvanRooijen commented Sep 2, 2026

Copy link
Copy Markdown
Member

Second of the three flagged dedup refactors. A theorem is checked with either a Solver or an
Optimize, carried as a Z3Object, and both AssertConstraints and AssertBounds held the same
switch (approach) { case Solver: solver.Assert(x); case Optimize: optimize.Assert(x); } block to
add a term. That block now lives in one private Assert(Z3Object, BoolExpr) helper, so asserting a
term reads as Assert(approach, term) and the Solver-or-Optimize dispatch for asserting has a single
home.

The other per-approach operations are distinct and stay where they are: Check() and ReasonUnknown
are already concise switch expressions, and applying the limits is a different operation (it sets a
property, under a guard).

Pure extraction - no behaviour change, no allocation change.

Verified

  • dotnet build solutions/Z3.Linq.slnx -c Release - clean.
  • 322/322 tests green.
  • ./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

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
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Test Results

  1 files    1 suites   11s ⏱️
309 tests 309 ✅ 0 💤 0 ❌
322 runs  322 ✅ 0 💤 0 ❌

Results for commit be8044f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant