Skip to content

fix: refuse a closed set's base-class member the generators introduce, and keep its sealed ToString() - #218

Merged
CaffeinatedCoder merged 1 commit into
release/2.3.1from
fix/closed-set-base-member-refused-2-3-1
Oct 31, 2026
Merged

CaffeinatedCoder merged 1 commit into
release/2.3.1from
fix/closed-set-base-member-refused-2-3-1

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #205

Problem

ClosedSetTypes read the set's own members alone. A base class's Parse(string), Parse(string, bool), TryParse(string?, bool, out TSelf), Match, a static All, a protected _name, an IParsable<TSelf> it implements, and its sealed ToString() failed the aspect (LAMA0500, LAMA0502, LAMA0503, LAMA0512) naming nothing the user wrote, in this project and from another. A base class's ToString() that is not sealed was replaced by the generated one without a word, where a value object's base record's is CMTK1011.

Change

  • Names and signatures are checked on each base class, private members aside (a base's private _name and _all built and still do); an IParsable<TSelf> a base implements is named with its base. CMTK1011 says "in its base type X".
  • A base's sealed ToString() is the seam, through ValueObjectDeclaration.DeclaresToString; one not sealed is CMTK1011 with the value objects' remedy (declare ToString() in the set, or seal the base's).
  • Breaking for a build that passed on 2.3.0: a closed set over a base class whose ToString() is not sealed. Decision 121 records refusing over taking it as the seam (which would change what such a set prints in a patch, without a word) and the exception to decision 34; the changelog says what to write instead.
  • CS0738 joins CS0535 as what a refused set may leave in BuildOutcomeTests, where a base's All has another type.
  • Generators README, design/aspects.md, design/closed-sets.md, the ADR index, two claims.

Tests

Found by a sweep of release/2.3.1 @ dbdd44e for the defect class of #191-#197.

🤖 Generated with Claude Code

…, and keep its sealed ToString()

ClosedSetTypes read the set's own members alone. A base class's
Parse(string), Parse(string, bool), TryParse(string?, bool, out TSelf),
Match, a static All, a protected _name, an IParsable<TSelf> it
implements, and its sealed ToString() failed the aspect (LAMA0500,
LAMA0502, LAMA0503, LAMA0512), naming nothing the user wrote, in this
project and from another. A base class's ToString() that is not sealed
was replaced by the generated one without a word, where a value
object's base record's has been CMTK1011 since phase 11.

The checks of names and signatures now read each base class, private
members aside (a base's private _name and _all built and still do), and
an IParsable<TSelf> a base implements is named with its base. A base's
sealed ToString() is the seam, through ValueObjectDeclaration's own
check; one not sealed is CMTK1011 with the value objects' remedy.
Decision 121 records refusing it over taking it as the seam, which
would change what such a set prints in a patch, and the exception to
decision 34: such a set built on 2.3.0. CS0738 joins CS0535 as what a
refused set may leave, where a base's All has another type.

Input class (GTS): a generated closed-set member, by where it is
declared. Catalogue in BuildOutcomeTests: each member above in a base
class of this project, Parse, IParsable and both ToString() forms in a
library base, QualifiedName (refused before, through the interface
mapping), and four that build: a sealed ToString() of either assembly,
private fields, a [JsonConverter] on the base. InheritedMembersTests
holds what a set over a sealed ToString() prints. Siblings found by the
catalogue: All, Match, Parse(string, bool), TryParse(string?, bool, out)
and a protected _name, beyond the three the report named.

Removing the base reads and the ToString() refusal fails the 11 new
refusal rows and the two LAMA guards (13 of 310 BuildOutcomeTests);
reverting the seam fails the test project's build on MaskedSet.

Refs #205

Defect-Class: GTS
Found-By: CA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/value-objects Value-object contracts and what the aspects generate for them bug Something isn't working package/generators Affects CodoMetis.TypeKit.Generators severity/medium Inconsistency or failure in a narrow scenario silent Compiles or answers and does less than it appears to

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant