Skip to content

parser: fix GetMemberType for nested types - #37

Merged
rameel merged 1 commit into
mainfrom
parser/get-member-type-nested-types
Nov 19, 2026
Merged

rameel merged 1 commit into
mainfrom
parser/get-member-type-nested-types

Conversation

@rameel

@rameel rameel commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

GetMemberType is documented to return the member itself for a type, but it checked only MemberTypes.TypeInfo and threw ArgumentException for a nested type, whose MemberType is NestedType. IsStatic already handles both values.

This PR handles MemberTypes.NestedType as well and stops calling the declared type of the member its runtime type in the exception message.

The expression builder calls GetMemberType only for fields and properties, so parsing is not affected. The change has no test: the helper is internal, and this path cannot be reached through the public API.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

GetMemberType is documented to return the member itself for a type,
but it checked only MemberTypes.TypeInfo and threw ArgumentException
for a nested type, whose MemberType is NestedType. IsStatic already
handles both values. The expression builder calls GetMemberType only
for fields and properties, so parsing is not affected.

The exception message also called the declared type of the member
its runtime type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rameel
rameel merged commit 8fa9ed2 into main Nov 19, 2026
1 check passed
@rameel
rameel deleted the parser/get-member-type-nested-types branch November 19, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant