You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CMTK0005 reports a multidimensional array with a zero dimension, such as new Plain[0, 2], which holds no element #227
Reported by an external review of release/2.3.1 @ dbdd44e, which reproduced it; the cause confirmed here by reading the source, not yet run.
Package
CodoMetis.TypeKit.Analyzers
Version
2.3.0 (the same code in v2.3.0), and release/2.3.1 @ dbdd44e
How does it fail?
Loudly. A warning on an array that holds no element
Problem
DefaultFilledCollectionAnalyzer.AnalyzeArrayCreation (src/CodoMetis.TypeKit.Analyzers/DefaultFilledCollectionAnalyzer.cs:69) skips an empty array only when every dimension is a constant 0 (All). A multidimensional array is empty when any dimension is 0, so new Plain[0, 2] holds no default value object and is reported.
Scenario
varnone=newPlain[0,2];// CMTK0005; expected: nothing, it has no elementsvaralso=newPlain[2,0];// the samevarsome=newPlain[2,2];// CMTK0005, rightly
stackalloc (:110) has one dimension, where All and Any agree.
Change
Any in place of All at :69. A Warning reporting less needs no exception to decision 34.
Test
CMTK0005 rows for [0, 2], [2, 0], [0, 0], a jagged [0][] and [2, 2], the last reported; reverted per verify-the-guard. Input class: an array creation of a value object, by rank and which dimension is a constant zero.
Fixed in #233. Running the input class across how the zero is written found a sibling, fixed in its own commit there (Found-By: VA): the zero check matched only a boxed int, so new Plain[0L], [0u, 2], [2, 0ul] and stackalloc Plain[(byte)0], [(short)0], ['\0'] were reported too. One IsZero now reads every integral constant.
Activity
fix: CMTK0005 reads a zero length of any integral type as zero
CaffeinatedCoder commentedon Oct 31, 2026
Fixed in #233. Running the input class across how the zero is written found a sibling, fixed in its own commit there (
Found-By: VA): the zero check matched only a boxedint, sonew Plain[0L],[0u, 2],[2, 0ul]andstackalloc Plain[(byte)0],[(short)0],['\0']were reported too. OneIsZeronow reads every integral constant.CaffeinatedCoder commentedon Oct 31, 2026
Fixed by #233, merged into
release/2.3.1(2e60d4c); ships in 2.3.1.