Fully qualify references to generated interfaces#1
Draft
simonmckenzie wants to merge 7 commits intoChristianSauer:masterfrom
Draft
Conversation
8e7605b to
640a9bb
Compare
This addresses an issue where, when a class references a generated interface, those references are not fully qualified, resulting in an interface that doesn't compile. The change is to precalculate the list of interface names that will be generated, and, during symbol string generation, replace unrecognised symbols with generated names _where a single unambiguous match can be made between the symbol and the list of interfaces being generated_.
- Change approach to use `ToDisplayParts`, which removes the need for regex parsing of generated code - Fix bug in `ReplaceWithInferredInterfaceName` where dots weren't being escaped - Add tests to ensure partially qualified references will be resolved correctly
…class; refactor This centralises the rendering logic plus simplifies the implementation to use `ITypeSymbol.WithNullableAnnotation` and hands the rendering off to the default `ToDisplayString` implementation
640a9bb to
44b679e
Compare
Author
|
Hi @ChristianSauer , I see the RoslynExtensions class is now marked with an explicit comment: Does this mean any customisations I want to apply should be moved into a different extensions class, to keep |
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 is a copy of codecentric#89, reopening after the sunsetting of that project.
This addresses an issue where, when a class references a generated interface, those references are not fully qualified, resulting in an interface that doesn't compile. See codecentric#87.
The change is to precalculate the list of interface names that will be generated, and, during symbol string generation, replace unrecognised symbols with generated names where a single unambiguous match can be made between the symbol and the list of interfaces being generated.
For the example provided in codecentric#87, the code will now generate this output: