Skip to content

Extract MemberClrType for the property/field type switch - #107

Draft
HowardvanRooijen wants to merge 1 commit into
feature/csharp-modernizationfrom
feature/member-clr-type-helper
Draft

Extract MemberClrType for the property/field type switch#107
HowardvanRooijen wants to merge 1 commit into
feature/csharp-modernizationfrom
feature/member-clr-type-helper

Conversation

@HowardvanRooijen

@HowardvanRooijen HowardvanRooijen commented Sep 2, 2026

Copy link
Copy Markdown
Member

First of three small dedup refactors flagged during the modernisation review. The
member switch { PropertyInfo => .PropertyType, FieldInfo => .FieldType, _ => throw } shape - "a
symbol is a property or a field, and its declared type is one or the other" - appeared verbatim in
three places: SymbolType, the environment builder (GetEnvironment(MemberInfo, ...)) and the
marshaller (ConvertZ3Expression). A single private MemberClrType(MemberInfo) helper now owns it.

Pure extraction - no behaviour change, and no allocation change (the helper is a small static method
the JIT inlines back to the switch it replaced).

Verified

  • dotnet build solutions/Z3.Linq.slnx -c Release - clean, TreatWarningsAsErrors on.
  • 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

The `member switch { PropertyInfo => .PropertyType, FieldInfo => .FieldType,
_ => throw }` shape appeared verbatim in three places - SymbolType, the
environment builder and the marshaller. One private helper now owns it, so the
"a symbol is a property or a field, and its type is one or the other" rule has
a single name and a single definition.

Pure extraction: 322 tests unchanged, and allocation cannot change - the tiny
helper is a static method the JIT inlines back to the switch it replaced.

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  ±0    1 suites  ±0   11s ⏱️ ±0s
309 tests ±0  309 ✅ ±0  0 💤 ±0  0 ❌ ±0 
322 runs  ±0  322 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 2302f4f. ± Comparison against base commit 3037795.

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