Repository navigation
Keep items whose ToString() is null in ToStringEnumerable and Join [patch] - #163
Merged
Merged
Conversation
… Join ToStringEnumerable filtered on the projected string, so NullItemHandling.Throw and Remove silently dropped a non-null item whose ToString() returns null, while Join emitted the same item as an empty entry. Null handling now tests the item only, such an item becomes "", and Join delegates to ToStringEnumerable so the two always agree. Fixes #153 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P2fpLkFHYU6nd3JVKufVtK
|
This was referenced Oct 9, 2026
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.



Fixes #153
What changes
This follows the triage on the issue.
NullItemHandlingnow tests the item, as the XML docs say ("null items"), and never tests the string the item turns into.ToStringEnumerable(items, h)filters on the item, then projects it. A non-null item whoseToString()returnsnullbecomes""in every mode, soThrowno longer silently removes an element.Join(items, sep, h)is nowstring.Join(sep, items.ToStringEnumerable(h)). The invariantJoin(sep, h) == string.Join(sep, ToStringEnumerable(h))therefore holds by construction.<returns>doc now states this rule.For the issue's repro
[new N(), "x"],ToStringEnumerablenow gives["", "x"]in all three modes, matchingJoin's",x". The parameterlessToStringEnumerable()also keeps such an item as""where it used to drop it. #138's single-pass enumeration is unchanged.Tests
NullItemHandlingmode, the parameterless overload, andJoin/ToStringEnumerableagreement.🤖 Generated with Claude Code
https://claude.ai/code/session_01P2fpLkFHYU6nd3JVKufVtK
Generated by Claude Code