Repository navigation
Show the explicit interface implementation in IDeepCloneable's remarks [patch] - #121
Merged
Merged
Conversation
…s [patch] The remarks recommended `public object DeepClone() => DeepClone();`, which calls itself until the stack overflows, or fails with CS0111 once the strongly-typed DeepClone() is added beside it. Show the explicit implementation DeepCloneable<T> already uses, and test that the documented pattern clones through the interface. Fixes #120 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW2HqCSuHeAzmHzLkRc
|
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 #120
What changed
The
<remarks>onIDeepCloneable.DeepClone()recommendedpublic object DeepClone() => DeepClone();. Copied as written, that method calls itself until the process dies with an uncatchable stack overflow. Adding the strongly-typedFoo DeepClone()beside it fails instead with CS0111.The remarks now show the explicit interface implementation that
DeepCloneable<T>already uses:They also say why the other two forms fail.
Tests
IDeepCloneableDocumentationTestsadds two tests:DocumentedPattern_DeepCloneThroughInterface_ReturnsIndependentCopyimplementsIDeepCloneableexactly as documented and clones the type through the interface, so the pattern has to keep compiling and working.Remarks_RecommendExplicitInterfaceImplementationreads the generatedktsu.DeepClone.xmland checks that the remarks show the explicit form and no longer give the self-recursive line as the example. It fails onmainand passes with this change. I checked that by reverting the doc change and running it again.Full suite: 68/68 passing on net10.0.
Generated by Claude Code