perf(http-client-csharp): avoid Roslyn simplifier for type names#10916
Draft
ArcturusZhang wants to merge 3 commits into
Draft
perf(http-client-csharp): avoid Roslyn simplifier for type names#10916ArcturusZhang wants to merge 3 commits into
ArcturusZhang wants to merge 3 commits into
Conversation
Emit C# type names through a per-file analyzer that collects referenced types, uses a namespace prefix trie to choose safe imports/qualifications, and omits global:: in the optimized path. Skip Roslyn Simplifier.ReduceAsync when no custom rewriters require it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
commit: |
Contributor
|
No changes needing a change description found. |
Resolve ambiguous type names with full namespace qualification instead of invalid namespace suffixes, and emit compound assignment statements without parentheses so generated code remains compilable without Roslyn simplification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep expression statement writing unchanged for now and leave non-type Roslyn simplifications out of the type-name resolver change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 PR adds an emission-time C# type-name analyzer for the http-client-csharp generator. It collects type references per generated file, resolves safe imports/qualifications with a namespace prefix trie, omits global:: in the optimized path, and skips Roslyn Simplifier.ReduceAsync when no custom Roslyn rewriters are registered.
Validation:
Note: full Microsoft.TypeSpec.Generator.Tests has plugin-build tests blocked locally because this machine has .NET SDK 10.0.300 while the repo global.json requests 10.0.103 with latestPatch roll-forward.