Repository navigation
fix: a base's private member of a generated name is hidden from the value object, not refused - #244
Merged
CaffeinatedCoder merged 2 commits intoOct 31, 2026
Conversation
…alue object, not refused 2.3.1's base checks read every member of every base at any accessibility: Declared over SelfAndBases in ValueObjectDeclaration.GeneratedMembersDeclaredByHand (#197), InheritedSeams (#195) and the base loop of ValueObjectComparableAspect.HandWrittenComparisonMembers (#194), and, from #218, the method lines of ClosedSetTypes.GeneratedMembersDeclaredByHand (#205). C# hides a base's private member from the derived type, so it stands in for no generated member: a base record's private MaxValue, Parse, TryFrom or CompareTo(object) failed the build with CMTK1011 or CMTK1008, where 2.3.0 generated the value object, and a set's base class's private Parse(string) with CMTK1011. Each base check now counts only a member the type can see (IsAccessibleFrom), on the value object and on the closed set, whose field and property line read Accessibility != Private and now reads the same. A value object nested in its base sees the base's private members, as C# does, and stays refused; a library's private and internal ones were never listed by Metalama and still build. Input class (GTS): a base member of a generated member's name or signature, by accessibility. BaseMemberAccessibility is the catalogue: private, private protected, protected, internal, protected internal and public, by each name the checks read (Value, From, MinValue, MaxValue, Parse and TryParse over string, span and UTF-8, ToString(string?, IFormatProvider?), TryFormat, CompareTo(object), CompareTo(TSelf), TryFrom, Revalidate) and a closed set's Parse, TryParse and Match: 108 types in the consumer of BuildOutcomeTests. The 19 private ones build, the 80 others and the nested one are refused naming the base, and a library's hidden members build. InheritedMembersTests holds what the private ones generate. Reverting the source fails the 19 private rows and refuses the three types of InheritedMembersTests in the test project's own build; counting only a base's public members fails the 76 protected and internal rows and the nested one. No sibling outside these checks: the other base reads (equality, PrintMembers, an unsealed ToString()) match members C# requires to be public or protected in a record. Closes #230 Defect-Class: GTS Found-By: CA Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 31, 2026
Base automatically changed from
fix/generic-or-ref-overload-refused-2-3-1
to
release/2.3.1
October 31, 2026 11:41
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Closes #230
Stacked on #236 (
fix/generic-or-ref-overload-refused-2-3-1, #226), which is stacked on #218. Both touchValueObjectDeclaration.csandClosedSetTypes.cs. Merge in order: #218, then #236, then this PR. This PR also answers the sweep's finding against #218 on #205: a set's base class's privateParse(string)was refused.Problem
The base-member checks that 2.3.1 added read every member of every base, whatever its accessibility:
DeclaredoverSelfAndBasesinValueObjectDeclaration.GeneratedMembersDeclaredByHand(A base record's public implementation of a generated member is kept as the value object's, or crashes the aspect #197)InheritedSeams(A base record's explicit Create from another project leaves two rule sets #195)ValueObjectComparableAspect.HandWrittenComparisonMembers(An inherited CompareTo(TSelf) is not seen: EF Core orders by the column, and < overflows the stack #194)ClosedSetTypes.GeneratedMembersDeclaredByHand(A closed set over a base class that declares a generated member fails with a Metalama error, or its ToString() is replaced #205)C# hides a base's private member from the derived type, so it stands in for no generated member. Yet a base record's private
MaxValue,Parse,TryFromorCompareTo(object)failed the build with CMTK1011 or CMTK1008, where 2.3.0 generated the value object. A set's base class's privateParse(string)failed the same way.Change
IsAccessibleFrom, Metalama 2026.1).MembersNamedandMethodsWithSignaturetake the type that looks (seenFrom), andInheritedSeams, the comparable aspect's base loop and the closed set's base reads filter the same way. The closed set's field and property line readAccessibility != Privatebefore and now reads the same as the rest.design/aspects.md, two claims, a CHANGELOG line. No decision record: decision 121 refuses a member "wherever the value object reaches it", and a private one isn't reached.Tests
BaseMemberAccessibility(new) is the input class's catalogue, built inBuildOutcomeTests' consumer. It crosses 6 accessibilities (private, private protected, protected, internal, protected internal, public) with every name the checks read:Value,From,MinValue,MaxValue,Parse/TryParseover string, span and UTF-8,ToString(string?, IFormatProvider?),TryFormat,CompareTo(object),CompareTo(TSelf),TryFrom,Revalidate, and a set'sParse,TryParseandMatch. The 19 private rows build. The 80 others and the nested row are refused naming the base. A library's hidden members build.InheritedMembersTests: over a base with every private name, each generated member is what a call reaches. That coversMaxValue == int.MaxValue, parsing, formatting, the ordering without[HandWrittenOrdering],TryFrom(-1)is none,Revalidate, and a set'sParse,TryParseandMatch.tools/BuildVerdict: Generators.Tests 1371 passed, Conventions.Tests 2016, Samples 150.🤖 Generated with Claude Code