Repository navigation
fix: CMTK0005 and CMTK0006 report a new()-constrained value-object parameter, as CMTK0001 does - #216
Merged
CaffeinatedCoder merged 1 commit intoOct 31, 2026
Conversation
…rameter, as CMTK0001 does CMTK0005 and CMTK0006 decided "no default" with IsNoDefaultStruct, which admitted a type parameter only beside struct. CMTK0001 and CMTK0009 use DefaultRestriction, which also admits a parameter bound by the marker beside new() and no class bound: a generated class has no public parameterless constructor, so such a T is a struct value object. So for where T : IEntityId<T>, new(), new T() was CMTK0001 while new T[3] and an unassigned T field reported nothing, although the README defines both rules over CMTK0001's list. IsNoDefaultStruct is now DefaultRestriction(type) is not null, the predicate CMTK0001 reads. Both rules are Warnings, which the README lets learn forms in a minor version. Input class (AIS): what the judged type is. Catalogue: TypeArgumentKinds, 80 kinds with the one added here (a new() parameter bound by an interface deriving from IValue<int>, the reported shape). NoDefaultKindTests runs CMTK0001, CMTK0005 and CMTK0006 over every kind against one oracle, the README's list; CMTK0001 agreed on all 80 before the fix, and the two new() kinds were the only rows where the other two did not. No other sibling: only these two rules called the narrow predicate. Reverting the source fails the 4 new() rows of 240. Refs #207 Defect-Class: AIS Found-By: CA Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 30, 2026
CaffeinatedCoder
deleted the
fix/no-default-new-constrained-parameter-2-3-1
branch
October 31, 2026 07:47
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 #207
Problem
CMTK0005 and CMTK0006 decided "no default" with
TypeKitSymbols.IsNoDefaultStruct, which admitted a type parameter only besidestruct. CMTK0001 and CMTK0009 useDefaultRestriction, which also admits a parameter bound by the marker besidenew(): a generated class has no public parameterless constructor, so such aTis a struct value object. Forwhere T : IEntityId<T>, new(),new T()was CMTK0001 whilenew T[3]and an unassignedTfield reported nothing, although the Analyzers README defines both rules over CMTK0001's list.Change
IsNoDefaultStructisDefaultRestriction(type) is not null, the predicate CMTK0001 reads. Both rules are Warnings, which the README lets learn forms in a minor version, so no exception to decision 34. Changelog line under 2.3.1.Tests
NoDefaultKindTestsruns CMTK0001, CMTK0005 and CMTK0006 over every kind ofTypeArgumentKinds(80, with the reported shape added: anew()parameter bound by an interface deriving fromIValue<int>) against one oracle, the README's list. CMTK0001 agreed on all 80 before the fix; the twonew()kinds were the only rows where the other two did not.new()rows of 240.Found by a sweep of
release/2.3.1@dbdd44efor the defect class of #191-#197.🤖 Generated with Claude Code