Work around a diagnostic using CommandLine.arguments
on older toolchains.
#2625
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.
…hains. (#2622)
CommandLine.arguments
is declared read/write in older toolchains and this causes an error diagnostic when it's used in Swift 6 mode. This PR usesCommandLine.argc
andCommandLine.unsafeArgv
directly instead so the diagnostic does not occur.Cherry-picked from
main
(#2622, 6c459f2) because certain combinations of toolchains and swift-syntax versions are now incompatible. Until that issue is resolved and those toolchains have aged out, the workaround is needed, but we can presumably revert it in a few weeks if it's bothersome.Explanation: Certain combinations of toolchains and swift-syntax versions are now incompatible. A build error occurs when using swift-syntax-600 with those toolchains.
Scope: Implementation only.
Issue: #2622
Original PR: #2622
Risk: No obvious risk. The implementation of
CommandLine.arguments
is equivalent to the code added in this PR.Testing: Tested at desk with the change locally and pulling from the main branch after it was merged there. The diagnostic is gone.
Reviewer: @bnbarham @ahoppen