Report error diagnostic when a specific overload from a single template would be generated multiple times#2
Merged
InsanityCode merged 8 commits intoJun 2, 2024
Conversation
…plate would be generated multiple times
…ad-duplicates # Conflicts: # ChaosGenerators/source/TemplateGenerator.cs
InsanityCode
requested changes
Jun 1, 2024
Member
There was a problem hiding this comment.
The overall changes seem fine to me.
I implemented your suggestions regarding the elimination of anonymous types and using ChaosUtil.Primitives (see #4), so if these changes meet your expectations, please merge them into this PR.
As mentioned here, I think raising a warning would be enough, but changing the error to a warning can be done later.
…ad-duplicates-review diagnose generating overload duplicates - review
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.
This adds an error diagnostic when a single template delegate in combination with its respective
TemplateGeneratorattribute would generate the same overload multiple times.For exmample, the following code would generate an error diagnostic:
It may be better to use ChaosUtil's Array equality checks rather than the somewhat scuffed
OverloadComparersolution, which would then operate on aTemplateParametertype (or similar in name) replacing the anonymous((Regex, string), ITypeSymbol)type, hence the draft label.