Extract MemberClrType for the property/field type switch - #107
Draft
HowardvanRooijen wants to merge 1 commit into
Draft
Extract MemberClrType for the property/field type switch#107HowardvanRooijen wants to merge 1 commit into
HowardvanRooijen wants to merge 1 commit into
Conversation
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
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.
First of three small dedup refactors flagged during the modernisation review. The
member switch { PropertyInfo => .PropertyType, FieldInfo => .FieldType, _ => throw }shape - "asymbol 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 themarshaller (
ConvertZ3Expression). A single privateMemberClrType(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,TreatWarningsAsErrorson../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