Emit single-file helper types below the method class instead of mid-file#738
Merged
tannergooding merged 1 commit intoJul 13, 2026
Conversation
In single-file mode the deferred method class (`Methods`) was flushed after the generate-helper-types helper types, so with both a struct and functions the helpers were emitted between the struct and `Methods` -- in the middle of the file rather than at the top or bottom. Flush the deferred method class output builders before the helper types so the helpers join the shared namespace at the bottom, after all user content. Fixes dotnet#429 Co-authored-by: Copilot App <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.
In single-file mode the deferred method class (
Methods) was flushed after thegenerate-helper-typeshelper types, so with both a struct and functions the helpers were emitted between the struct andMethods-- in the middle of the file rather than at the top or bottom. Flush the deferred method class output builders before the helper types so the helpers join the shared namespace at the bottom, after all user content.Multi-file mode is unchanged: the method-class builders are already written directly to their own files, so the relocated loops are a no-op there.
Added
HelperTypesEmittedAfterMethodClassandHelperTypesEmittedAfterMethodClassFileScopedregression tests covering block-scoped and file-scoped single-file output with both a struct and a function, asserting the orderstruct -> Methods -> helper typeswith a single set of usings and no duplicate namespace.Fixes #429