-
Notifications
You must be signed in to change notification settings - Fork 439
BasicFormat should not format unexpected nodes #1759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxRewriterFile.swift
Show resolved
Hide resolved
d9a1976
to
1e75014
Compare
@swift-ci please test |
1e75014
to
28f0fd8
Compare
@swift-ci please test |
28f0fd8
to
1e76baf
Compare
@swift-ci please test |
@@ -475,6 +475,7 @@ extension OperatorTable { | |||
) { | |||
self.opPrecedence = opPrecedence | |||
self.errorHandler = errorHandler | |||
super.init(viewMode: .sourceAccurate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really only want to fold source accurate nodes here? I would think of sequence folding as a semantic operation and thus think that it might be better off folding the fixed up tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we wouldn't be folding at all if there's any errors 😅. Let's say there's a bunch of unexpected nodes, do we expect folding to remove them all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, except we won't remove them (thanks @rintaro). So I suppose I don't really have a preference here. I can do fixed up 🤷
swift-format also uses |
bae6ff8
to
2c46280
Compare
@swift-ci please test |
@swift-ci please test Windows platform |
2c46280
to
96cc428
Compare
`BasicFormat` depends on the parent layout nodes to determine formatting in some cases, so it doesn't make sense to visit unexpected nodes. Also fix up `SyntaxRewriter` to take a `viewMode`, since as it was `BasicFormat` was actually visiting `missing` nodes, which also doesn't make much sense. Resolves rdar://110463876.
96cc428
to
9227d5b
Compare
@swift-ci please test |
@swift-ci please test Windows platform |
BasicFormat
depends on the parent layout nodes to determine formatting in some cases, so it doesn't make sense to visit unexpected nodes.Also fix up
SyntaxRewriter
to take aviewMode
, since as it wasBasicFormat
was actually visitingmissing
nodes, which also doesn't make much sense.Resolves rdar://110463876.