BridgeJS: Emit protocol array for-loop as a single CodeBlockItemSyntax#1
Closed
krodak wants to merge 1 commit intountitled-in-brackets:chore/relax-swift-syntax-constraintfrom
Conversation
The protocol array lowering built its for-loop from separate
CodeBlockItemSyntax fragments ('for ... {', body, '}'), which is not
a well-formed statement unit. swift-syntax 603's formatter then
rendered the closing brace glued to the previous line in the
generated output.
Combine the for-loop into a single multi-line CodeBlockItemSyntax,
matching the pattern already used for nullable protocol return
lowering, so the formatter produces consistent output across
swift-syntax 600-603.
Author
|
Superseded by swiftwasm#716, which covers this fix and more (all three |
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.
Overview
Fixes the formatter mis-rendering flagged by @kateinoigakukun in swiftwasm#714 so we can land the swift-syntax 603 bump on CI.
The protocol array lowering in
StackCodegen.lowerProtocolArrayStatementsbuilt itsfor-loop from three separateCodeBlockItemSyntaxfragments ("for ... {", body line,"}"). swift-syntax 603's formatter then rendered the closing brace glued to the previous line, producing output like:This change combines the
for-loop into a single multi-lineCodeBlockItemSyntaxusing a string-interpolated multi-line literal, matching the pattern already used for nullable protocol return lowering a bit further up in the file. The formatter now produces consistent output across swift-syntax 600/601/602/603:The only affected snapshot is
Protocol.swift(two occurrences).Verification
Ran the BridgeJS test suite against every swift-syntax version the CI matrix covers, all 105/106 tests passing:
Merge this into `chore/relax-swift-syntax-constraint` and the PR's CI matrix should go green.